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
fix(database): modified_at updated for every state change for Payment Attempts (#5312)
Sandeep Kumar926dcd3a3c0f
diff --git a/crates/diesel_models/src/address.rs b/crates/diesel_models/src/address.rsindex aa1d397797..d695d2a0e7 100644--- a/crates/diesel_models/src/address.rs+++ b/crates/diesel_models/src/address.rs@@ -1,5 +1,5 @@use common_utils::id_type;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use time::PrimitiveDateTime;@@ -29,8 +29,8 @@ pub struct AddressNew {pub email: Option<Encryption>,}-#[derive(Clone, Debug, Queryable, Identifiable, Serialize, Deserialize)]-#[diesel(table_name = address, primary_key(address_id))]+#[derive(Clone, Debug, Queryable, Identifiable, Selectable, Serialize, Deserialize)]+#[diesel(table_name = address, primary_key(address_id), check_for_backend(diesel::pg::Pg))]pub struct Address {pub id: Option<i32>,pub address_id: String,diff --git a/crates/diesel_models/src/api_keys.rs b/crates/diesel_models/src/api_keys.rsindex 7676e20d22..3b6de46e08 100644--- a/crates/diesel_models/src/api_keys.rs+++ b/crates/diesel_models/src/api_keys.rs@@ -1,11 +1,13 @@-use diesel::{AsChangeset, AsExpression, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, AsExpression, Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use time::PrimitiveDateTime;use crate::schema::api_keys;-#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Identifiable, Queryable)]-#[diesel(table_name = api_keys, primary_key(key_id))]+#[derive(+ serde::Serialize, serde::Deserialize, Debug, Clone, Identifiable, Queryable, Selectable,+)]+#[diesel(table_name = api_keys, primary_key(key_id), check_for_backend(diesel::pg::Pg))]pub struct ApiKey {pub key_id: String,pub merchant_id: String,diff --git a/crates/diesel_models/src/authentication.rs b/crates/diesel_models/src/authentication.rsindex a94cbe9605..050bc291c0 100644--- a/crates/diesel_models/src/authentication.rs+++ b/crates/diesel_models/src/authentication.rs@@ -1,11 +1,13 @@-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use serde::{self, Deserialize, Serialize};use serde_json;use crate::schema::authentication;-#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Serialize, Deserialize)]-#[diesel(table_name = authentication, primary_key(authentication_id))]+#[derive(+ Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize,+)]+#[diesel(table_name = authentication, primary_key(authentication_id), check_for_backend(diesel::pg::Pg))]pub struct Authentication {pub authentication_id: String,pub merchant_id: String,diff --git a/crates/diesel_models/src/authorization.rs b/crates/diesel_models/src/authorization.rsindex a7f13821d8..694577bba3 100644--- a/crates/diesel_models/src/authorization.rs+++ b/crates/diesel_models/src/authorization.rs@@ -1,13 +1,14 @@use common_utils::types::MinorUnit;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use time::PrimitiveDateTime;use crate::{enums as storage_enums, schema::incremental_authorization};-#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Serialize, Deserialize, Hash)]-#[diesel(table_name = incremental_authorization)]-#[diesel(primary_key(authorization_id, merchant_id))]+#[derive(+ Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize, Hash,+)]+#[diesel(table_name = incremental_authorization, primary_key(authorization_id, merchant_id), check_for_backend(diesel::pg::Pg))]pub struct Authorization {pub authorization_id: String,pub merchant_id: String,diff --git a/crates/diesel_models/src/blocklist.rs b/crates/diesel_models/src/blocklist.rsindex 9e88802aa3..14dbaf2fe4 100644--- a/crates/diesel_models/src/blocklist.rs+++ b/crates/diesel_models/src/blocklist.rs@@ -1,4 +1,4 @@-use diesel::{Identifiable, Insertable, Queryable};+use diesel::{Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use crate::schema::blocklist;@@ -13,8 +13,10 @@ pub struct BlocklistNew {pub created_at: time::PrimitiveDateTime,}-#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Deserialize, Serialize)]-#[diesel(table_name = blocklist)]+#[derive(+ Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Deserialize, Serialize,+)]+#[diesel(table_name = blocklist, check_for_backend(diesel::pg::Pg))]pub struct Blocklist {#[serde(skip)]pub id: i32,diff --git a/crates/diesel_models/src/blocklist_fingerprint.rs b/crates/diesel_models/src/blocklist_fingerprint.rsindex e75856622e..ceea5134bb 100644--- a/crates/diesel_models/src/blocklist_fingerprint.rs+++ b/crates/diesel_models/src/blocklist_fingerprint.rs@@ -1,4 +1,4 @@-use diesel::{Identifiable, Insertable, Queryable};+use diesel::{Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use crate::schema::blocklist_fingerprint;@@ -13,8 +13,10 @@ pub struct BlocklistFingerprintNew {pub created_at: time::PrimitiveDateTime,}-#[derive(Clone, Debug, Eq, PartialEq, Queryable, Identifiable, Deserialize, Serialize)]-#[diesel(table_name = blocklist_fingerprint)]+#[derive(+ Clone, Debug, Eq, PartialEq, Queryable, Identifiable, Selectable, Deserialize, Serialize,+)]+#[diesel(table_name = blocklist_fingerprint, check_for_backend(diesel::pg::Pg))]pub struct BlocklistFingerprint {#[serde(skip_serializing)]pub id: i32,diff --git a/crates/diesel_models/src/blocklist_lookup.rs b/crates/diesel_models/src/blocklist_lookup.rsindex ad2a893e03..bebad02e78 100644--- a/crates/diesel_models/src/blocklist_lookup.rs+++ b/crates/diesel_models/src/blocklist_lookup.rs@@ -1,4 +1,4 @@-use diesel::{Identifiable, Insertable, Queryable};+use diesel::{Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use crate::schema::blocklist_lookup;@@ -10,8 +10,19 @@ pub struct BlocklistLookupNew {pub fingerprint: String,}-#[derive(Default, Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Deserialize, Serialize)]-#[diesel(table_name = blocklist_lookup)]+#[derive(+ Default,+ Clone,+ Debug,+ Eq,+ PartialEq,+ Identifiable,+ Queryable,+ Selectable,+ Deserialize,+ Serialize,+)]+#[diesel(table_name = blocklist_lookup, check_for_backend(diesel::pg::Pg))]pub struct BlocklistLookup {#[serde(skip)]pub id: i32,diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rsindex 48eedc6110..af34311906 100644--- a/crates/diesel_models/src/business_profile.rs+++ b/crates/diesel_models/src/business_profile.rs@@ -1,5 +1,5 @@use common_utils::pii;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use crate::schema::business_profile;@@ -10,9 +10,10 @@ use crate::schema::business_profile;serde::Serialize,Identifiable,Queryable,+ Selectable,router_derive::DebugAsDisplay,)]-#[diesel(table_name = business_profile, primary_key(profile_id))]+#[diesel(table_name = business_profile, primary_key(profile_id), check_for_backend(diesel::pg::Pg))]pub struct BusinessProfile {pub profile_id: String,pub merchant_id: String,diff --git a/crates/diesel_models/src/capture.rs b/crates/diesel_models/src/capture.rsindex 0a66ae789a..cff09638a4 100644--- a/crates/diesel_models/src/capture.rs+++ b/crates/diesel_models/src/capture.rs@@ -1,13 +1,14 @@use common_utils::types::MinorUnit;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use time::PrimitiveDateTime;use crate::{enums as storage_enums, schema::captures};-#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Serialize, Deserialize, Hash)]-#[diesel(table_name = captures)]-#[diesel(primary_key(capture_id))]+#[derive(+ Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize, Hash,+)]+#[diesel(table_name = captures, primary_key(capture_id), check_for_backend(diesel::pg::Pg))]pub struct Capture {pub capture_id: String,pub payment_id: String,diff --git a/crates/diesel_models/src/cards_info.rs b/crates/diesel_models/src/cards_info.rsindex 8f0a4af23a..3e0d24723d 100644--- a/crates/diesel_models/src/cards_info.rs+++ b/crates/diesel_models/src/cards_info.rs@@ -1,10 +1,12 @@-use diesel::{Identifiable, Queryable};+use diesel::{Identifiable, Queryable, Selectable};use time::PrimitiveDateTime;use crate::{enums as storage_enums, schema::cards_info};-#[derive(Clone, Debug, Queryable, Identifiable, serde::Deserialize, serde::Serialize)]-#[diesel(table_name = cards_info, primary_key(card_iin))]+#[derive(+ Clone, Debug, Queryable, Identifiable, Selectable, serde::Deserialize, serde::Serialize,+)]+#[diesel(table_name = cards_info, primary_key(card_iin), check_for_backend(diesel::pg::Pg))]pub struct CardInfo {pub card_iin: String,pub card_issuer: Option<String>,diff --git a/crates/diesel_models/src/configs.rs b/crates/diesel_models/src/configs.rsindex 35fbb44647..2b30aa6a97 100644--- a/crates/diesel_models/src/configs.rs+++ b/crates/diesel_models/src/configs.rs@@ -1,6 +1,6 @@use std::convert::From;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use crate::schema::configs;@@ -13,9 +13,8 @@ pub struct ConfigNew {pub config: String,}-#[derive(Default, Clone, Debug, Identifiable, Queryable, Deserialize, Serialize)]-#[diesel(table_name = configs)]-+#[derive(Default, Clone, Debug, Identifiable, Queryable, Selectable, Deserialize, Serialize)]+#[diesel(table_name = configs, check_for_backend(diesel::pg::Pg))]pub struct Config {#[serde(skip)]pub id: i32,diff --git a/crates/diesel_models/src/customers.rs b/crates/diesel_models/src/customers.rsindex 63be0351a0..deb1ac73f4 100644--- a/crates/diesel_models/src/customers.rs+++ b/crates/diesel_models/src/customers.rs@@ -1,5 +1,5 @@use common_utils::{id_type, pii};-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use time::PrimitiveDateTime;use crate::{encryption::Encryption, schema::customers};@@ -52,8 +52,10 @@ impl From<CustomerNew> for Customer {}}-#[derive(Clone, Debug, Identifiable, Queryable, serde::Deserialize, serde::Serialize)]-#[diesel(table_name = customers)]+#[derive(+ Clone, Debug, Identifiable, Queryable, Selectable, serde::Deserialize, serde::Serialize,+)]+#[diesel(table_name = customers, check_for_backend(diesel::pg::Pg))]pub struct Customer {pub id: i32,pub customer_id: id_type::CustomerId,diff --git a/crates/diesel_models/src/dispute.rs b/crates/diesel_models/src/dispute.rsindex eae8281a99..184dce1564 100644--- a/crates/diesel_models/src/dispute.rs+++ b/crates/diesel_models/src/dispute.rs@@ -1,5 +1,5 @@use common_utils::custom_serde;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use masking::Secret;use serde::Serialize;use time::PrimitiveDateTime;@@ -32,8 +32,8 @@ pub struct DisputeNew {pub dispute_amount: i64,}-#[derive(Clone, Debug, PartialEq, Serialize, Identifiable, Queryable)]-#[diesel(table_name = dispute)]+#[derive(Clone, Debug, PartialEq, Serialize, Identifiable, Queryable, Selectable)]+#[diesel(table_name = dispute, check_for_backend(diesel::pg::Pg))]pub struct Dispute {#[serde(skip_serializing)]pub id: i32,@@ -83,7 +83,7 @@ pub enum DisputeUpdate {},}-#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]+#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]#[diesel(table_name = dispute)]pub struct DisputeUpdateInternal {dispute_stage: Option<storage_enums::DisputeStage>,@@ -93,7 +93,7 @@ pub struct DisputeUpdateInternal {connector_reason_code: Option<String>,challenge_required_by: Option<PrimitiveDateTime>,connector_updated_at: Option<PrimitiveDateTime>,- modified_at: Option<PrimitiveDateTime>,+ modified_at: PrimitiveDateTime,evidence: Option<Secret<serde_json::Value>>,}@@ -116,8 +116,8 @@ impl From<DisputeUpdate> for DisputeUpdateInternal {connector_reason_code,challenge_required_by,connector_updated_at,- modified_at: Some(common_utils::date_time::now()),- ..Default::default()+ modified_at: common_utils::date_time::now(),+ evidence: None,},DisputeUpdate::StatusUpdate {dispute_status,@@ -125,12 +125,24 @@ impl From<DisputeUpdate> for DisputeUpdateInternal {} => Self {dispute_status: Some(dispute_status),connector_status,- modified_at: Some(common_utils::date_time::now()),- ..Default::default()+ modified_at: common_utils::date_time::now(),+ dispute_stage: None,+ connector_reason: None,+ connector_reason_code: None,+ challenge_required_by: None,+ connector_updated_at: None,+ evidence: None,},DisputeUpdate::EvidenceUpdate { evidence } => Self {evidence: Some(evidence),- ..Default::default()+ dispute_stage: None,+ dispute_status: None,+ connector_status: None,+ connector_reason: None,+ connector_reason_code: None,+ challenge_required_by: None,+ connector_updated_at: None,+ modified_at: common_utils::date_time::now(),},}}diff --git a/crates/diesel_models/src/events.rs b/crates/diesel_models/src/events.rsindex fe87f307fb..b3b1230441 100644--- a/crates/diesel_models/src/events.rs+++ b/crates/diesel_models/src/events.rs@@ -1,7 +1,6 @@use common_utils::custom_serde;use diesel::{- deserialize::FromSqlRow, expression::AsExpression, AsChangeset, Identifiable, Insertable,- Queryable,+ expression::AsExpression, AsChangeset, Identifiable, Insertable, Queryable, Selectable,};use serde::{Deserialize, Serialize};use time::PrimitiveDateTime;@@ -36,8 +35,8 @@ pub struct EventUpdateInternal {pub response: Option<Encryption>,}-#[derive(Clone, Debug, Deserialize, Serialize, Identifiable, Queryable)]-#[diesel(table_name = events, primary_key(event_id))]+#[derive(Clone, Debug, Deserialize, Serialize, Identifiable, Queryable, Selectable)]+#[diesel(table_name = events, primary_key(event_id), check_for_backend(diesel::pg::Pg))]pub struct Event {pub event_id: String,pub event_type: storage_enums::EventType,@@ -60,7 +59,7 @@ pub struct Event {pub metadata: Option<EventMetadata>,}-#[derive(Clone, Debug, Deserialize, Serialize, AsExpression, FromSqlRow)]+#[derive(Clone, Debug, Deserialize, Serialize, AsExpression, diesel::FromSqlRow)]#[diesel(sql_type = diesel::sql_types::Jsonb)]pub enum EventMetadata {Payment {diff --git a/crates/diesel_models/src/file.rs b/crates/diesel_models/src/file.rsindex 20150a6928..af584323b9 100644--- a/crates/diesel_models/src/file.rs+++ b/crates/diesel_models/src/file.rs@@ -1,5 +1,5 @@use common_utils::custom_serde;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use masking::{Deserialize, Serialize};use crate::schema::file_metadata;@@ -21,8 +21,8 @@ pub struct FileMetadataNew {pub merchant_connector_id: Option<String>,}-#[derive(Clone, Debug, Deserialize, Serialize, Identifiable, Queryable)]-#[diesel(table_name = file_metadata, primary_key(file_id, merchant_id))]+#[derive(Clone, Debug, Deserialize, Serialize, Identifiable, Queryable, Selectable)]+#[diesel(table_name = file_metadata, primary_key(file_id, merchant_id), check_for_backend(diesel::pg::Pg))]pub struct FileMetadata {#[serde(skip_serializing)]pub file_id: String,diff --git a/crates/diesel_models/src/fraud_check.rs b/crates/diesel_models/src/fraud_check.rsindex 5513afcfbd..2cda6bbd7f 100644--- a/crates/diesel_models/src/fraud_check.rs+++ b/crates/diesel_models/src/fraud_check.rs@@ -1,5 +1,5 @@use common_enums as storage_enums;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use masking::{Deserialize, Serialize};use time::PrimitiveDateTime;@@ -7,8 +7,8 @@ use crate::{enums::{FraudCheckLastStep, FraudCheckStatus, FraudCheckType},schema::fraud_check,};-#[derive(Clone, Debug, Identifiable, Queryable, Serialize, Deserialize)]-#[diesel(table_name = fraud_check, primary_key(payment_id, merchant_id))]+#[derive(Clone, Debug, Identifiable, Queryable, Selectable, Serialize, Deserialize)]+#[diesel(table_name = fraud_check, primary_key(payment_id, merchant_id), check_for_backend(diesel::pg::Pg))]pub struct FraudCheck {pub frm_id: String,pub payment_id: String,diff --git a/crates/diesel_models/src/generic_link.rs b/crates/diesel_models/src/generic_link.rsindex b3e3da7a6d..1017d2d47d 100644--- a/crates/diesel_models/src/generic_link.rs+++ b/crates/diesel_models/src/generic_link.rs@@ -5,16 +5,17 @@ use common_utils::{PayoutLinkData, PayoutLinkStatus,},};-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use masking::Secret;use serde::{Deserialize, Serialize};use time::{Duration, PrimitiveDateTime};use crate::{enums as storage_enums, schema::generic_link};-#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Serialize, Deserialize)]-#[diesel(table_name = generic_link)]-#[diesel(primary_key(link_id))]+#[derive(+ Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize,+)]+#[diesel(table_name = generic_link, primary_key(link_id), check_for_backend(diesel::pg::Pg))]pub struct GenericLink {pub link_id: String,pub primary_reference: String,diff --git a/crates/diesel_models/src/gsm.rs b/crates/diesel_models/src/gsm.rsindex 231f60bb25..6a444410fa 100644--- a/crates/diesel_models/src/gsm.rs+++ b/crates/diesel_models/src/gsm.rs@@ -4,7 +4,7 @@ use common_utils::{custom_serde,events::{ApiEventMetric, ApiEventsType},};-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use time::PrimitiveDateTime;use crate::schema::gateway_status_map;@@ -19,9 +19,10 @@ use crate::schema::gateway_status_map;router_derive::DebugAsDisplay,Identifiable,Queryable,+ Selectable,serde::Serialize,)]-#[diesel(table_name = gateway_status_map, primary_key(connector, flow, sub_flow, code, message))]+#[diesel(table_name = gateway_status_map, primary_key(connector, flow, sub_flow, code, message), check_for_backend(diesel::pg::Pg))]pub struct GatewayStatusMap {pub connector: String,pub flow: String,diff --git a/crates/diesel_models/src/locker_mock_up.rs b/crates/diesel_models/src/locker_mock_up.rsindex e078b272cb..e88ad95e23 100644--- a/crates/diesel_models/src/locker_mock_up.rs+++ b/crates/diesel_models/src/locker_mock_up.rs@@ -1,10 +1,10 @@use common_utils::id_type;-use diesel::{Identifiable, Insertable, Queryable};+use diesel::{Identifiable, Insertable, Queryable, Selectable};use crate::schema::locker_mock_up;-#[derive(Clone, Debug, Eq, Identifiable, Queryable, PartialEq)]-#[diesel(table_name = locker_mock_up)]+#[derive(Clone, Debug, Eq, Identifiable, Queryable, Selectable, PartialEq)]+#[diesel(table_name = locker_mock_up, check_for_backend(diesel::pg::Pg))]pub struct LockerMockUp {pub id: i32,pub card_id: String,diff --git a/crates/diesel_models/src/mandate.rs b/crates/diesel_models/src/mandate.rsindex 9a32e1049d..793174dea7 100644--- a/crates/diesel_models/src/mandate.rs+++ b/crates/diesel_models/src/mandate.rs@@ -1,13 +1,15 @@use common_enums::MerchantStorageScheme;use common_utils::{id_type, pii};-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use masking::Secret;use time::PrimitiveDateTime;use crate::{enums as storage_enums, schema::mandate};-#[derive(Clone, Debug, Identifiable, Queryable, serde::Serialize, serde::Deserialize)]-#[diesel(table_name = mandate)]+#[derive(+ Clone, Debug, Identifiable, Queryable, Selectable, serde::Serialize, serde::Deserialize,+)]+#[diesel(table_name = mandate, check_for_backend(diesel::pg::Pg))]pub struct Mandate {pub id: i32,pub mandate_id: String,diff --git a/crates/diesel_models/src/merchant_account.rs b/crates/diesel_models/src/merchant_account.rsindex f0078ca0ba..71c437bbb4 100644--- a/crates/diesel_models/src/merchant_account.rs+++ b/crates/diesel_models/src/merchant_account.rs@@ -1,5 +1,5 @@use common_utils::pii;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use crate::{encryption::Encryption, enums as storage_enums, schema::merchant_account};@@ -10,9 +10,10 @@ use crate::{encryption::Encryption, enums as storage_enums, schema::merchant_accserde::Serialize,Identifiable,Queryable,+ Selectable,router_derive::DebugAsDisplay,)]-#[diesel(table_name = merchant_account)]+#[diesel(table_name = merchant_account, check_for_backend(diesel::pg::Pg))]pub struct MerchantAccount {pub id: i32,pub merchant_id: String,diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rsindex e01c465d1b..05707f7173 100644--- a/crates/diesel_models/src/merchant_connector_account.rs+++ b/crates/diesel_models/src/merchant_connector_account.rs@@ -1,7 +1,7 @@use std::fmt::Debug;use common_utils::pii;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use masking::Secret;use crate::{encryption::Encryption, enums as storage_enums, schema::merchant_connector_account};@@ -13,9 +13,10 @@ use crate::{encryption::Encryption, enums as storage_enums, schema::merchant_conserde::Deserialize,Identifiable,Queryable,+ Selectable,router_derive::DebugAsDisplay,)]-#[diesel(table_name = merchant_connector_account)]+#[diesel(table_name = merchant_connector_account, check_for_backend(diesel::pg::Pg))]pub struct MerchantConnectorAccount {pub id: i32,pub merchant_id: String,diff --git a/crates/diesel_models/src/merchant_key_store.rs b/crates/diesel_models/src/merchant_key_store.rsindex ef17ace149..30781927e9 100644--- a/crates/diesel_models/src/merchant_key_store.rs+++ b/crates/diesel_models/src/merchant_key_store.rs@@ -1,5 +1,5 @@use common_utils::custom_serde;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use time::PrimitiveDateTime;use crate::{encryption::Encryption, schema::merchant_key_store};@@ -11,10 +11,10 @@ use crate::{encryption::Encryption, schema::merchant_key_store};serde::Deserialize,Identifiable,Queryable,+ Selectable,router_derive::DebugAsDisplay,)]-#[diesel(table_name = merchant_key_store)]-#[diesel(primary_key(merchant_id))]+#[diesel(table_name = merchant_key_store, primary_key(merchant_id), check_for_backend(diesel::pg::Pg))]pub struct MerchantKeyStore {pub merchant_id: String,pub key: Encryption,diff --git a/crates/diesel_models/src/organization.rs b/crates/diesel_models/src/organization.rsindex 2f407b8cbf..5c2012a6d9 100644--- a/crates/diesel_models/src/organization.rs+++ b/crates/diesel_models/src/organization.rs@@ -1,9 +1,9 @@-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use crate::schema::organization;-#[derive(Clone, Debug, Identifiable, Queryable)]-#[diesel(table_name = organization, primary_key(org_id))]+#[derive(Clone, Debug, Identifiable, Queryable, Selectable)]+#[diesel(table_name = organization, primary_key(org_id), check_for_backend(diesel::pg::Pg))]pub struct Organization {pub org_id: String,pub org_name: Option<String>,diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rsindex c45eee7b0c..626de94710 100644--- a/crates/diesel_models/src/payment_attempt.rs+++ b/crates/diesel_models/src/payment_attempt.rs@@ -1,5 +1,5 @@use common_utils::pii;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use time::PrimitiveDateTime;@@ -8,8 +8,10 @@ use crate::{schema::payment_attempt,};-#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Serialize, Deserialize)]-#[diesel(table_name = payment_attempt, primary_key(attempt_id, merchant_id))]+#[derive(+ Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize,+)]+#[diesel(table_name = payment_attempt, primary_key(attempt_id, merchant_id), check_for_backend(diesel::pg::Pg))]pub struct PaymentAttempt {pub payment_id: String,pub merchant_id: String,@@ -92,9 +94,7 @@ pub struct PaymentListFilters {pub payment_method: Vec<storage_enums::PaymentMethod>,}-#[derive(- Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay, Serialize, Deserialize,-)]+#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay, Serialize, Deserialize)]#[diesel(table_name = payment_attempt)]pub struct PaymentAttemptNew {pub payment_id: String,@@ -117,10 +117,10 @@ pub struct PaymentAttemptNew {pub capture_on: Option<PrimitiveDateTime>,pub confirm: bool,pub authentication_type: Option<storage_enums::AuthenticationType>,- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]- pub created_at: Option<PrimitiveDateTime>,- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]- pub modified_at: Option<PrimitiveDateTime>,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub created_at: PrimitiveDateTime,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub modified_at: PrimitiveDateTime,#[serde(default, with = "common_utils::custom_serde::iso8601::option")]pub last_synced: Option<PrimitiveDateTime>,pub cancellation_reason: Option<String>,@@ -366,7 +366,7 @@ pub enum PaymentAttemptUpdate {},}-#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]+#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]#[diesel(table_name = payment_attempt)]pub struct PaymentAttemptUpdateInternal {amount: Option<i64>,@@ -381,7 +381,7 @@ pub struct PaymentAttemptUpdateInternal {error_message: Option<Option<String>>,payment_method_id: Option<String>,cancellation_reason: Option<String>,- modified_at: Option<PrimitiveDateTime>,+ modified_at: PrimitiveDateTime,mandate_id: Option<String>,browser_info: Option<serde_json::Value>,payment_token: Option<String>,@@ -571,7 +571,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_type,payment_method,payment_token,- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),payment_method_data,payment_method_type,payment_experience,@@ -583,16 +583,85 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {fingerprint_id,payment_method_billing_address_id,updated_by,- ..Default::default()+ net_amount: None,+ connector_transaction_id: None,+ connector: None,+ error_message: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ error_code: None,+ connector_metadata: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ amount_capturable: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::AuthenticationTypeUpdate {authentication_type,updated_by,} => Self {authentication_type: Some(authentication_type),- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),updated_by,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ status: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ connector: None,+ payment_method: None,+ error_message: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ error_code: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::ConfirmUpdate {amount,@@ -631,7 +700,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_type,status: Some(status),payment_method,- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),browser_info,connector: connector.map(Some),payment_token,@@ -657,7 +726,21 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {client_source,client_version,customer_acceptance,- ..Default::default()+ net_amount: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ cancellation_reason: None,+ mandate_id: None,+ connector_metadata: None,+ preprocessing_step_id: None,+ error_reason: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ charge_id: None,},PaymentAttemptUpdate::VoidUpdate {status,@@ -666,8 +749,50 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {} => Self {status: Some(status),cancellation_reason,+ modified_at: common_utils::date_time::now(),updated_by,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ connector: None,+ authentication_type: None,+ payment_method: None,+ error_message: None,+ payment_method_id: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ error_code: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::RejectUpdate {status,@@ -676,10 +801,51 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {updated_by,} => Self {status: Some(status),+ modified_at: common_utils::date_time::now(),error_code,error_message,updated_by,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ connector: None,+ authentication_type: None,+ payment_method: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::BlocklistUpdate {status,@@ -688,20 +854,102 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {updated_by,} => Self {status: Some(status),+ modified_at: common_utils::date_time::now(),error_code,connector: Some(None),error_message,updated_by,merchant_connector_id: Some(None),- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ authentication_type: None,+ payment_method: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::PaymentMethodDetailsUpdate {payment_method_id,updated_by,} => Self {payment_method_id,+ modified_at: common_utils::date_time::now(),updated_by,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ status: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ connector: None,+ authentication_type: None,+ payment_method: None,+ error_message: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ error_code: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::ResponseUpdate {status,@@ -730,7 +978,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {connector_transaction_id,authentication_type,payment_method_id,- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),mandate_id,connector_metadata,error_code,@@ -746,7 +994,31 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {unified_message,payment_method_data,charge_id,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ amount_to_capture: None,+ payment_method: None,+ cancellation_reason: None,+ browser_info: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ capture_method: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ merchant_connector_id: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::ErrorUpdate {connector,@@ -766,7 +1038,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {status: Some(status),error_message,error_code,- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),error_reason,amount_capturable,updated_by,@@ -775,12 +1047,87 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {connector_transaction_id,payment_method_data,authentication_type,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ amount_to_capture: None,+ payment_method: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ connector_metadata: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::StatusUpdate { status, updated_by } => Self {status: Some(status),+ modified_at: common_utils::date_time::now(),updated_by,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ connector: None,+ authentication_type: None,+ payment_method: None,+ error_message: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ error_code: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::UpdateTrackers {payment_token,@@ -793,6 +1140,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {merchant_connector_id,} => Self {payment_token,+ modified_at: common_utils::date_time::now(),connector: connector.map(Some),straight_through_algorithm,amount_capturable,@@ -800,7 +1148,43 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {tax_amount,updated_by,merchant_connector_id: merchant_connector_id.map(Some),- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ status: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ authentication_type: None,+ payment_method: None,+ error_message: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ error_code: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::UnresolvedResponseUpdate {status,@@ -817,13 +1201,48 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {connector: connector.map(Some),connector_transaction_id,payment_method_id,- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),error_code,error_message,error_reason,connector_response_reference_id,updated_by,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ amount_to_capture: None,+ authentication_type: None,+ payment_method: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ capture_method: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::PreprocessingUpdate {status,@@ -836,13 +1255,50 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {} => Self {status: Some(status),payment_method_id,- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),connector_metadata,preprocessing_step_id,connector_transaction_id,connector_response_reference_id,updated_by,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ amount_to_capture: None,+ connector: None,+ authentication_type: None,+ payment_method: None,+ error_message: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ error_code: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ error_reason: None,+ capture_method: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::CaptureUpdate {multiple_capture_count,@@ -850,9 +1306,51 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {amount_to_capture,} => Self {multiple_capture_count,+ modified_at: common_utils::date_time::now(),updated_by,amount_to_capture,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ status: None,+ connector_transaction_id: None,+ connector: None,+ authentication_type: None,+ payment_method: None,+ error_message: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ error_code: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::AmountToCaptureUpdate {status,@@ -860,9 +1358,51 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {updated_by,} => Self {status: Some(status),+ modified_at: common_utils::date_time::now(),amount_capturable: Some(amount_capturable),updated_by,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ connector: None,+ authentication_type: None,+ payment_method: None,+ error_message: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ error_code: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::ConnectorResponse {authentication_data,@@ -876,17 +1416,99 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {encoded_data,connector_transaction_id,connector: connector.map(Some),+ modified_at: common_utils::date_time::now(),updated_by,charge_id,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ status: None,+ amount_to_capture: None,+ authentication_type: None,+ payment_method: None,+ error_message: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ error_code: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ merchant_connector_id: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::IncrementalAuthorizationAmountUpdate {amount,amount_capturable,} => Self {amount: Some(amount),+ modified_at: common_utils::date_time::now(),amount_capturable: Some(amount_capturable),- ..Default::default()+ net_amount: None,+ currency: None,+ status: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ connector: None,+ authentication_type: None,+ payment_method: None,+ error_message: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ error_code: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ updated_by: String::default(),+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::AuthenticationUpdate {status,@@ -896,11 +1518,51 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {updated_by,} => Self {status: Some(status),+ modified_at: common_utils::date_time::now(),external_three_ds_authentication_attempted,authentication_connector,authentication_id,updated_by,- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ connector: None,+ authentication_type: None,+ payment_method: None,+ error_message: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ error_code: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ error_reason: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},PaymentAttemptUpdate::ManualUpdate {status,@@ -913,12 +1575,50 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {} => Self {status,error_code: error_code.map(Some),+ modified_at: common_utils::date_time::now(),error_message: error_message.map(Some),error_reason: error_reason.map(Some),updated_by,unified_code: unified_code.map(Some),unified_message: unified_message.map(Some),- ..Default::default()+ amount: None,+ net_amount: None,+ currency: None,+ connector_transaction_id: None,+ amount_to_capture: None,+ connector: None,+ authentication_type: None,+ payment_method: None,+ payment_method_id: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ connector_metadata: None,+ payment_method_data: None,+ payment_method_type: None,+ payment_experience: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ capture_method: None,+ connector_response_reference_id: None,+ multiple_capture_count: None,+ surcharge_amount: None,+ tax_amount: None,+ amount_capturable: None,+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ fingerprint_id: None,+ payment_method_billing_address_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,},}}diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rsindex 0272f8fec1..8deca44253 100644--- a/crates/diesel_models/src/payment_intent.rs+++ b/crates/diesel_models/src/payment_intent.rs@@ -1,13 +1,13 @@use common_enums::RequestIncrementalAuthorization;use common_utils::{id_type, pii, types::MinorUnit};-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use time::PrimitiveDateTime;use crate::{encryption::Encryption, enums as storage_enums, schema::payment_intent};-#[derive(Clone, Debug, PartialEq, Identifiable, Queryable, Serialize, Deserialize)]-#[diesel(table_name = payment_intent, primary_key(payment_id, merchant_id))]+#[derive(Clone, Debug, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize)]+#[diesel(table_name = payment_intent, primary_key(payment_id, merchant_id), check_for_backend(diesel::pg::Pg))]pub struct PaymentIntent {pub payment_id: String,pub merchant_id: String,@@ -85,10 +85,10 @@ pub struct PaymentIntentNew {pub billing_address_id: Option<String>,pub statement_descriptor_name: Option<String>,pub statement_descriptor_suffix: Option<String>,- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]- pub created_at: Option<PrimitiveDateTime>,- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]- pub modified_at: Option<PrimitiveDateTime>,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub created_at: PrimitiveDateTime,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub modified_at: PrimitiveDateTime,#[serde(default, with = "common_utils::custom_serde::iso8601::option")]pub last_synced: Option<PrimitiveDateTime>,pub setup_future_usage: Option<storage_enums::FutureUsage>,@@ -228,7 +228,7 @@ pub struct PaymentIntentUpdateFields {pub shipping_details: Option<Encryption>,}-#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]+#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]#[diesel(table_name = payment_intent)]pub struct PaymentIntentUpdateInternal {pub amount: Option<MinorUnit>,@@ -242,7 +242,7 @@ pub struct PaymentIntentUpdateInternal {pub metadata: Option<serde_json::Value>,pub billing_address_id: Option<String>,pub shipping_address_id: Option<String>,- pub modified_at: Option<PrimitiveDateTime>,+ pub modified_at: PrimitiveDateTime,pub active_attempt_id: Option<String>,pub business_country: Option<storage_enums::CountryAlpha2>,pub business_label: Option<String>,@@ -360,9 +360,39 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {updated_by,} => Self {metadata: Some(metadata),- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),updated_by,- ..Default::default()+ amount: None,+ currency: None,+ status: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ billing_address_id: None,+ shipping_address_id: None,+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ merchant_decision: None,+ payment_confirm_source: None,+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::Update(value) => Self {amount: Some(value.amount),@@ -391,7 +421,15 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {billing_details: value.billing_details,merchant_order_reference_id: value.merchant_order_reference_id,shipping_details: value.shipping_details,- ..Default::default()+ amount_captured: None,+ off_session: None,+ modified_at: common_utils::date_time::now(),+ active_attempt_id: None,+ attempt_count: None,+ merchant_decision: None,+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ authorization_count: None,},PaymentIntentUpdate::PaymentCreateUpdate {return_url,@@ -408,9 +446,34 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {shipping_address_id,billing_address_id,customer_details,- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),updated_by,- ..Default::default()+ amount: None,+ currency: None,+ amount_captured: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ merchant_decision: None,+ payment_confirm_source: None,+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::PGStatusUpdate {status,@@ -418,10 +481,39 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {incremental_authorization_allowed,} => Self {status: Some(status),- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),updated_by,incremental_authorization_allowed,- ..Default::default()+ amount: None,+ currency: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ billing_address_id: None,+ shipping_address_id: None,+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ merchant_decision: None,+ payment_confirm_source: None,+ surcharge_applicable: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::MerchantStatusUpdate {status,@@ -432,9 +524,37 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {status: Some(status),shipping_address_id,billing_address_id,- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),updated_by,- ..Default::default()+ amount: None,+ currency: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ merchant_decision: None,+ payment_confirm_source: None,+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::ResponseUpdate {// amount,@@ -454,10 +574,36 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {fingerprint_id,// customer_id,return_url,- modified_at: Some(common_utils::date_time::now()),+ modified_at: common_utils::date_time::now(),updated_by,incremental_authorization_allowed,- ..Default::default()+ amount: None,+ currency: None,+ customer_id: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ billing_address_id: None,+ shipping_address_id: None,+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ merchant_decision: None,+ payment_confirm_source: None,+ surcharge_applicable: None,+ authorization_count: None,+ session_expiry: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::PaymentAttemptAndAttemptCountUpdate {active_attempt_id,@@ -467,7 +613,37 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {active_attempt_id: Some(active_attempt_id),attempt_count: Some(attempt_count),updated_by,- ..Default::default()+ amount: None,+ currency: None,+ status: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ billing_address_id: None,+ shipping_address_id: None,+ modified_at: common_utils::date_time::now(),+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ merchant_decision: None,+ payment_confirm_source: None,+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::StatusAndAttemptUpdate {status,@@ -479,7 +655,36 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {active_attempt_id: Some(active_attempt_id),attempt_count: Some(attempt_count),updated_by,- ..Default::default()+ amount: None,+ currency: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ billing_address_id: None,+ shipping_address_id: None,+ modified_at: common_utils::date_time::now(),+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ merchant_decision: None,+ payment_confirm_source: None,+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::ApproveUpdate {status,@@ -489,7 +694,37 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {status: Some(status),merchant_decision,updated_by,- ..Default::default()+ amount: None,+ currency: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ billing_address_id: None,+ shipping_address_id: None,+ modified_at: common_utils::date_time::now(),+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ payment_confirm_source: None,+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::RejectUpdate {status,@@ -499,7 +734,37 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {status: Some(status),merchant_decision,updated_by,- ..Default::default()+ amount: None,+ currency: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ billing_address_id: None,+ shipping_address_id: None,+ modified_at: common_utils::date_time::now(),+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ payment_confirm_source: None,+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::SurchargeApplicableUpdate {surcharge_applicable,@@ -507,28 +772,186 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {} => Self {surcharge_applicable,updated_by,- ..Default::default()+ amount: None,+ currency: None,+ status: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ billing_address_id: None,+ shipping_address_id: None,+ modified_at: common_utils::date_time::now(),+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ merchant_decision: None,+ payment_confirm_source: None,+ incremental_authorization_allowed: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::IncrementalAuthorizationAmountUpdate { amount } => Self {amount: Some(amount),- ..Default::default()+ currency: None,+ status: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ billing_address_id: None,+ shipping_address_id: None,+ modified_at: common_utils::date_time::now(),+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ merchant_decision: None,+ payment_confirm_source: None,+ updated_by: String::default(),+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::AuthorizationCountUpdate {authorization_count,} => Self {authorization_count: Some(authorization_count),- ..Default::default()+ amount: None,+ currency: None,+ status: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ billing_address_id: None,+ shipping_address_id: None,+ modified_at: common_utils::date_time::now(),+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ merchant_decision: None,+ payment_confirm_source: None,+ updated_by: String::default(),+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::CompleteAuthorizeUpdate {shipping_address_id,} => Self {shipping_address_id,- ..Default::default()+ amount: None,+ currency: None,+ status: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ billing_address_id: None,+ modified_at: common_utils::date_time::now(),+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ merchant_decision: None,+ payment_confirm_source: None,+ updated_by: String::default(),+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},PaymentIntentUpdate::ManualUpdate { status, updated_by } => Self {status,updated_by,- ..Default::default()+ amount: None,+ currency: None,+ amount_captured: None,+ customer_id: None,+ return_url: None,+ setup_future_usage: None,+ off_session: None,+ metadata: None,+ billing_address_id: None,+ shipping_address_id: None,+ modified_at: common_utils::date_time::now(),+ active_attempt_id: None,+ business_country: None,+ business_label: None,+ description: None,+ statement_descriptor_name: None,+ statement_descriptor_suffix: None,+ order_details: None,+ attempt_count: None,+ merchant_decision: None,+ payment_confirm_source: None,+ surcharge_applicable: None,+ incremental_authorization_allowed: None,+ authorization_count: None,+ session_expiry: None,+ fingerprint_id: None,+ request_external_three_ds_authentication: None,+ frm_metadata: None,+ customer_details: None,+ billing_details: None,+ merchant_order_reference_id: None,+ shipping_details: None,},}}diff --git a/crates/diesel_models/src/payment_link.rs b/crates/diesel_models/src/payment_link.rsindex f4630c75d7..7937d2fbe3 100644--- a/crates/diesel_models/src/payment_link.rs+++ b/crates/diesel_models/src/payment_link.rs@@ -1,13 +1,12 @@use common_utils::types::MinorUnit;-use diesel::{Identifiable, Insertable, Queryable};+use diesel::{Identifiable, Insertable, Queryable, Selectable};use serde::{self, Deserialize, Serialize};use time::PrimitiveDateTime;use crate::{enums as storage_enums, schema::payment_link};-#[derive(Clone, Debug, Identifiable, Queryable, Serialize, Deserialize)]-#[diesel(table_name = payment_link)]-#[diesel(primary_key(payment_link_id))]+#[derive(Clone, Debug, Identifiable, Queryable, Selectable, Serialize, Deserialize)]+#[diesel(table_name = payment_link, primary_key(payment_link_id), check_for_backend(diesel::pg::Pg))]pub struct PaymentLink {pub payment_link_id: String,pub payment_id: String,diff --git a/crates/diesel_models/src/payment_method.rs b/crates/diesel_models/src/payment_method.rsindex 16e8ddeb7d..a9db90abb2 100644--- a/crates/diesel_models/src/payment_method.rs+++ b/crates/diesel_models/src/payment_method.rs@@ -1,14 +1,16 @@use common_enums::MerchantStorageScheme;use common_utils::{id_type, pii};-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use masking::Secret;use serde::{Deserialize, Serialize};use time::PrimitiveDateTime;use crate::{encryption::Encryption, enums as storage_enums, schema::payment_methods};-#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Serialize, Deserialize)]-#[diesel(table_name = payment_methods)]+#[derive(+ Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize,+)]+#[diesel(table_name = payment_methods, check_for_backend(diesel::pg::Pg))]pub struct PaymentMethod {pub id: i32,pub customer_id: id_type::CustomerId,diff --git a/crates/diesel_models/src/payout_attempt.rs b/crates/diesel_models/src/payout_attempt.rsindex 68c99d5ac0..9eb2a5a59d 100644--- a/crates/diesel_models/src/payout_attempt.rs+++ b/crates/diesel_models/src/payout_attempt.rs@@ -1,13 +1,14 @@use common_utils::id_type;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use serde::{self, Deserialize, Serialize};use time::PrimitiveDateTime;use crate::{enums as storage_enums, schema::payout_attempt};-#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Serialize, Deserialize)]-#[diesel(table_name = payout_attempt)]-#[diesel(primary_key(payout_attempt_id))]+#[derive(+ Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize,+)]+#[diesel(table_name = payout_attempt, primary_key(payout_attempt_id), check_for_backend(diesel::pg::Pg))]pub struct PayoutAttempt {pub payout_attempt_id: String,pub payout_id: String,diff --git a/crates/diesel_models/src/payouts.rs b/crates/diesel_models/src/payouts.rsindex 5cb06d7755..acef00b15d 100644--- a/crates/diesel_models/src/payouts.rs+++ b/crates/diesel_models/src/payouts.rs@@ -1,14 +1,15 @@use common_utils::{id_type, pii, types::MinorUnit};-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use serde::{self, Deserialize, Serialize};use time::PrimitiveDateTime;use crate::{enums as storage_enums, schema::payouts};// Payouts-#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Serialize, Deserialize)]-#[diesel(table_name = payouts)]-#[diesel(primary_key(payout_id))]+#[derive(+ Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize,+)]+#[diesel(table_name = payouts, primary_key(payout_id), check_for_backend(diesel::pg::Pg))]pub struct Payouts {pub payout_id: String,pub merchant_id: String,@@ -66,10 +67,10 @@ pub struct PayoutsNew {pub return_url: Option<String>,pub entity_type: storage_enums::PayoutEntityType,pub metadata: Option<pii::SecretSerdeValue>,- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]- pub created_at: Option<PrimitiveDateTime>,- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]- pub last_modified_at: Option<PrimitiveDateTime>,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub created_at: PrimitiveDateTime,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub last_modified_at: PrimitiveDateTime,pub attempt_count: i16,pub profile_id: String,pub status: storage_enums::PayoutStatus,diff --git a/crates/diesel_models/src/process_tracker.rs b/crates/diesel_models/src/process_tracker.rsindex 342ad8453a..cd2c429c55 100644--- a/crates/diesel_models/src/process_tracker.rs+++ b/crates/diesel_models/src/process_tracker.rs@@ -1,5 +1,5 @@use common_utils::ext_traits::Encode;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use error_stack::ResultExt;use serde::{Deserialize, Serialize};use time::PrimitiveDateTime;@@ -14,10 +14,11 @@ use crate::{enums as storage_enums, errors, schema::process_tracker, StorageResuDeserialize,Identifiable,Queryable,+ Selectable,Serialize,router_derive::DebugAsDisplay,)]-#[diesel(table_name = process_tracker)]+#[diesel(table_name = process_tracker, check_for_backend(diesel::pg::Pg))]pub struct ProcessTracker {pub id: String,pub name: Option<String>,diff --git a/crates/diesel_models/src/refund.rs b/crates/diesel_models/src/refund.rsindex 44d6133d8f..a3e767fdb3 100644--- a/crates/diesel_models/src/refund.rs+++ b/crates/diesel_models/src/refund.rs@@ -2,16 +2,24 @@ use common_utils::{pii,types::{ChargeRefunds, MinorUnit},};-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use time::PrimitiveDateTime;use crate::{enums as storage_enums, schema::refund};#[derive(- Clone, Debug, Eq, Identifiable, Queryable, PartialEq, serde::Serialize, serde::Deserialize,+ Clone,+ Debug,+ Eq,+ Identifiable,+ Queryable,+ Selectable,+ PartialEq,+ serde::Serialize,+ serde::Deserialize,)]-#[diesel(table_name = refund)]+#[diesel(table_name = refund, check_for_backend(diesel::pg::Pg))]pub struct Refund {pub id: i32,pub internal_reference_id: String,@@ -34,7 +42,7 @@ pub struct Refund {#[serde(with = "common_utils::custom_serde::iso8601")]pub created_at: PrimitiveDateTime,#[serde(with = "common_utils::custom_serde::iso8601")]- pub updated_at: PrimitiveDateTime,+ pub modified_at: PrimitiveDateTime,pub description: Option<String>,pub attempt_id: String,pub refund_reason: Option<String>,@@ -48,7 +56,6 @@ pub struct Refund {#[derive(Clone,Debug,- Default,Eq,PartialEq,Insertable,@@ -75,10 +82,10 @@ pub struct RefundNew {pub sent_to_gateway: bool,pub metadata: Option<pii::SecretSerdeValue>,pub refund_arn: Option<String>,- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]- pub created_at: Option<PrimitiveDateTime>,- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]- pub modified_at: Option<PrimitiveDateTime>,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub created_at: PrimitiveDateTime,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub modified_at: PrimitiveDateTime,pub description: Option<String>,pub attempt_id: String,pub refund_reason: Option<String>,@@ -88,6 +95,38 @@ pub struct RefundNew {pub charges: Option<ChargeRefunds>,}+impl Default for RefundNew {+ fn default() -> Self {+ Self {+ refund_id: Default::default(),+ payment_id: Default::default(),+ merchant_id: Default::default(),+ internal_reference_id: Default::default(),+ external_reference_id: Default::default(),+ connector_transaction_id: Default::default(),+ connector: Default::default(),+ connector_refund_id: Default::default(),+ refund_type: Default::default(),+ total_amount: Default::default(),+ currency: Default::default(),+ refund_amount: Default::default(),+ refund_status: Default::default(),+ sent_to_gateway: Default::default(),+ metadata: Default::default(),+ refund_arn: Default::default(),+ created_at: common_utils::date_time::now(),+ modified_at: common_utils::date_time::now(),+ description: Default::default(),+ attempt_id: Default::default(),+ refund_reason: Default::default(),+ profile_id: Default::default(),+ updated_by: Default::default(),+ merchant_connector_id: Default::default(),+ charges: Default::default(),+ }+ }+}+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]pub enum RefundUpdate {Update {@@ -124,7 +163,7 @@ pub enum RefundUpdate {},}-#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]+#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]#[diesel(table_name = refund)]pub struct RefundUpdateInternal {connector_refund_id: Option<String>,@@ -136,6 +175,7 @@ pub struct RefundUpdateInternal {refund_reason: Option<String>,refund_error_code: Option<String>,updated_by: String,+ modified_at: PrimitiveDateTime,}impl RefundUpdateInternal {@@ -150,6 +190,7 @@ impl RefundUpdateInternal {refund_reason: self.refund_reason,refund_error_code: self.refund_error_code,updated_by: self.updated_by,+ modified_at: self.modified_at,..source}}@@ -172,7 +213,10 @@ impl From<RefundUpdate> for RefundUpdateInternal {refund_error_message,refund_arn: Some(refund_arn),updated_by,- ..Default::default()+ metadata: None,+ refund_reason: None,+ refund_error_code: None,+ modified_at: common_utils::date_time::now(),},RefundUpdate::MetadataAndReasonUpdate {metadata,@@ -182,7 +226,13 @@ impl From<RefundUpdate> for RefundUpdateInternal {metadata,refund_reason: reason,updated_by,- ..Default::default()+ connector_refund_id: None,+ refund_status: None,+ sent_to_gateway: None,+ refund_error_message: None,+ refund_arn: None,+ refund_error_code: None,+ modified_at: common_utils::date_time::now(),},RefundUpdate::StatusUpdate {connector_refund_id,@@ -194,7 +244,12 @@ impl From<RefundUpdate> for RefundUpdateInternal {sent_to_gateway: Some(sent_to_gateway),refund_status: Some(refund_status),updated_by,- ..Default::default()+ refund_error_message: None,+ refund_arn: None,+ metadata: None,+ refund_reason: None,+ refund_error_code: None,+ modified_at: common_utils::date_time::now(),},RefundUpdate::ErrorUpdate {refund_status,@@ -208,7 +263,11 @@ impl From<RefundUpdate> for RefundUpdateInternal {refund_error_code,updated_by,connector_refund_id,- ..Default::default()+ sent_to_gateway: None,+ refund_arn: None,+ metadata: None,+ refund_reason: None,+ modified_at: common_utils::date_time::now(),},RefundUpdate::ManualUpdate {refund_status,@@ -220,7 +279,12 @@ impl From<RefundUpdate> for RefundUpdateInternal {refund_error_message,refund_error_code,updated_by,- ..Default::default()+ connector_refund_id: None,+ sent_to_gateway: None,+ refund_arn: None,+ metadata: None,+ refund_reason: None,+ modified_at: common_utils::date_time::now(),},}}@@ -238,6 +302,7 @@ impl RefundUpdate {refund_reason,refund_error_code,updated_by,+ modified_at: _,} = self.into();Refund {connector_refund_id: connector_refund_id.or(source.connector_refund_id),@@ -249,6 +314,7 @@ impl RefundUpdate {metadata: metadata.or(source.metadata),refund_reason: refund_reason.or(source.refund_reason),updated_by,+ modified_at: common_utils::date_time::now(),..source}}diff --git a/crates/diesel_models/src/reverse_lookup.rs b/crates/diesel_models/src/reverse_lookup.rsindex a9463d27b6..87fca34407 100644--- a/crates/diesel_models/src/reverse_lookup.rs+++ b/crates/diesel_models/src/reverse_lookup.rs@@ -1,4 +1,4 @@-use diesel::{Identifiable, Insertable, Queryable};+use diesel::{Identifiable, Insertable, Queryable, Selectable};use crate::schema::reverse_lookup;@@ -6,10 +6,17 @@ use crate::schema::reverse_lookup;/// This reverse lookup table basically looks up id's and get result_id that you want. This is/// useful for KV where you can't lookup without key#[derive(- Clone, Debug, serde::Serialize, serde::Deserialize, Identifiable, Queryable, Eq, PartialEq,+ Clone,+ Debug,+ serde::Serialize,+ serde::Deserialize,+ Identifiable,+ Queryable,+ Selectable,+ Eq,+ PartialEq,)]-#[diesel(table_name = reverse_lookup)]-#[diesel(primary_key(lookup_id))]+#[diesel(table_name = reverse_lookup, primary_key(lookup_id), check_for_backend(diesel::pg::Pg))]pub struct ReverseLookup {/// Primary key. The key id.pub lookup_id: String,diff --git a/crates/diesel_models/src/role.rs b/crates/diesel_models/src/role.rsindex 075d060255..b5b8062803 100644--- a/crates/diesel_models/src/role.rs+++ b/crates/diesel_models/src/role.rs@@ -1,10 +1,10 @@-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use time::PrimitiveDateTime;use crate::{enums, schema::roles};-#[derive(Clone, Debug, Identifiable, Queryable)]-#[diesel(table_name = roles)]+#[derive(Clone, Debug, Identifiable, Queryable, Selectable)]+#[diesel(table_name = roles, check_for_backend(diesel::pg::Pg))]pub struct Role {pub id: i32,pub role_name: String,diff --git a/crates/diesel_models/src/routing_algorithm.rs b/crates/diesel_models/src/routing_algorithm.rsindex 11e80f29da..4634dd1af4 100644--- a/crates/diesel_models/src/routing_algorithm.rs+++ b/crates/diesel_models/src/routing_algorithm.rs@@ -1,10 +1,10 @@-use diesel::{Identifiable, Insertable, Queryable};+use diesel::{Identifiable, Insertable, Queryable, Selectable};use serde::{Deserialize, Serialize};use crate::{enums, schema::routing_algorithm};-#[derive(Clone, Debug, Identifiable, Insertable, Queryable, Serialize, Deserialize)]-#[diesel(table_name = routing_algorithm, primary_key(algorithm_id))]+#[derive(Clone, Debug, Identifiable, Insertable, Queryable, Selectable, Serialize, Deserialize)]+#[diesel(table_name = routing_algorithm, primary_key(algorithm_id), check_for_backend(diesel::pg::Pg))]pub struct RoutingAlgorithm {pub algorithm_id: String,pub profile_id: String,diff --git a/crates/diesel_models/src/user.rs b/crates/diesel_models/src/user.rsindex b1bbb66256..56c6f00f2b 100644--- a/crates/diesel_models/src/user.rs+++ b/crates/diesel_models/src/user.rs@@ -1,5 +1,5 @@use common_utils::pii;-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use masking::Secret;use time::PrimitiveDateTime;@@ -10,8 +10,8 @@ use crate::{pub mod dashboard_metadata;pub mod sample_data;-#[derive(Clone, Debug, Identifiable, Queryable)]-#[diesel(table_name = users)]+#[derive(Clone, Debug, Identifiable, Queryable, Selectable)]+#[diesel(table_name = users, check_for_backend(diesel::pg::Pg))]pub struct User {pub id: i32,pub user_id: String,diff --git a/crates/diesel_models/src/user/dashboard_metadata.rs b/crates/diesel_models/src/user/dashboard_metadata.rsindex 48028ba6b5..a01f88fcb1 100644--- a/crates/diesel_models/src/user/dashboard_metadata.rs+++ b/crates/diesel_models/src/user/dashboard_metadata.rs@@ -1,10 +1,10 @@-use diesel::{query_builder::AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{query_builder::AsChangeset, Identifiable, Insertable, Queryable, Selectable};use time::PrimitiveDateTime;use crate::{enums, schema::dashboard_metadata};-#[derive(Clone, Debug, Identifiable, Queryable)]-#[diesel(table_name = dashboard_metadata)]+#[derive(Clone, Debug, Identifiable, Queryable, Selectable)]+#[diesel(table_name = dashboard_metadata, check_for_backend(diesel::pg::Pg))]pub struct DashboardMetadata {pub id: i32,pub user_id: Option<String>,diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rsindex 1d9cd87ad4..7a0f00acf8 100644--- a/crates/diesel_models/src/user/sample_data.rs+++ b/crates/diesel_models/src/user/sample_data.rs@@ -12,7 +12,7 @@ use crate::{};#[derive(- Clone, Debug, Default, diesel::Insertable, router_derive::DebugAsDisplay, Serialize, Deserialize,+ Clone, Debug, diesel::Insertable, router_derive::DebugAsDisplay, Serialize, Deserialize,)]#[diesel(table_name = payment_attempt)]pub struct PaymentAttemptBatchNew {@@ -35,10 +35,10 @@ pub struct PaymentAttemptBatchNew {pub capture_on: Option<PrimitiveDateTime>,pub confirm: bool,pub authentication_type: Option<AuthenticationType>,- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]- pub created_at: Option<PrimitiveDateTime>,- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]- pub modified_at: Option<PrimitiveDateTime>,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub created_at: PrimitiveDateTime,+ #[serde(with = "common_utils::custom_serde::iso8601")]+ pub modified_at: PrimitiveDateTime,#[serde(default, with = "common_utils::custom_serde::iso8601::option")]pub last_synced: Option<PrimitiveDateTime>,pub cancellation_reason: Option<String>,diff --git a/crates/diesel_models/src/user_authentication_method.rs b/crates/diesel_models/src/user_authentication_method.rsindex 2b4ed23c1d..18a65b9f10 100644--- a/crates/diesel_models/src/user_authentication_method.rs+++ b/crates/diesel_models/src/user_authentication_method.rs@@ -1,10 +1,10 @@-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use time::PrimitiveDateTime;use crate::{encryption::Encryption, enums, schema::user_authentication_methods};-#[derive(Clone, Debug, Identifiable, Queryable)]-#[diesel(table_name = user_authentication_methods)]+#[derive(Clone, Debug, Identifiable, Queryable, Selectable)]+#[diesel(table_name = user_authentication_methods, check_for_backend(diesel::pg::Pg))]pub struct UserAuthenticationMethod {pub id: String,pub auth_id: String,diff --git a/crates/diesel_models/src/user_key_store.rs b/crates/diesel_models/src/user_key_store.rsindex a35b4d9d16..1b19ef31a4 100644--- a/crates/diesel_models/src/user_key_store.rs+++ b/crates/diesel_models/src/user_key_store.rs@@ -1,11 +1,12 @@-use diesel::{Identifiable, Insertable, Queryable};+use diesel::{Identifiable, Insertable, Queryable, Selectable};use time::PrimitiveDateTime;use crate::{encryption::Encryption, schema::user_key_store};-#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Identifiable, Queryable)]-#[diesel(table_name = user_key_store)]-#[diesel(primary_key(user_id))]+#[derive(+ Clone, Debug, serde::Serialize, serde::Deserialize, Identifiable, Queryable, Selectable,+)]+#[diesel(table_name = user_key_store, primary_key(user_id), check_for_backend(diesel::pg::Pg))]pub struct UserKeyStore {pub user_id: String,pub key: Encryption,diff --git a/crates/diesel_models/src/user_role.rs b/crates/diesel_models/src/user_role.rsindex 3c32092fa9..ea8b626358 100644--- a/crates/diesel_models/src/user_role.rs+++ b/crates/diesel_models/src/user_role.rs@@ -1,10 +1,10 @@-use diesel::{AsChangeset, Identifiable, Insertable, Queryable};+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};use time::PrimitiveDateTime;use crate::{enums, schema::user_roles};-#[derive(Clone, Debug, Identifiable, Queryable)]-#[diesel(table_name = user_roles)]+#[derive(Clone, Debug, Identifiable, Queryable, Selectable)]+#[diesel(table_name = user_roles, check_for_backend(diesel::pg::Pg))]pub struct UserRole {pub id: i32,pub user_id: String,diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rsindex e7ccd6f33a..fb8ce2d696 100644--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs@@ -632,8 +632,8 @@ impl behaviour::Conversion for PaymentIntent {billing_address_id: self.billing_address_id,statement_descriptor_name: self.statement_descriptor_name,statement_descriptor_suffix: self.statement_descriptor_suffix,- created_at: Some(self.created_at),- modified_at: Some(self.modified_at),+ created_at: self.created_at,+ modified_at: self.modified_at,last_synced: self.last_synced,setup_future_usage: self.setup_future_usage,off_session: self.off_session,diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rsindex dc801e3754..6eb3561672 100644--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs@@ -630,7 +630,7 @@ impl From<PaymentIntentUpdate> for DieselPaymentIntentUpdate {impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateInternal {fn from(value: PaymentIntentUpdateInternal) -> Self {- let modified_at = Some(common_utils::date_time::now());+ let modified_at = common_utils::date_time::now();let PaymentIntentUpdateInternal {amount,diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rsindex cf45f07729..5b74eefb9a 100644--- a/crates/router/src/core/refunds.rs+++ b/crates/router/src/core/refunds.rs@@ -804,8 +804,8 @@ pub async fn validate_and_create_refund(.set_total_amount(payment_attempt.amount).set_refund_amount(refund_amount).set_currency(currency)- .set_created_at(Some(common_utils::date_time::now()))- .set_modified_at(Some(common_utils::date_time::now()))+ .set_created_at(common_utils::date_time::now())+ .set_modified_at(common_utils::date_time::now()).set_refund_status(enums::RefundStatus::Pending).set_metadata(req.metadata).set_description(req.reason.clone())@@ -1030,7 +1030,7 @@ impl ForeignFrom<storage::Refund> for api::RefundResponse {error_message: refund.refund_error_message,error_code: refund.refund_error_code,created_at: Some(refund.created_at),- updated_at: Some(refund.updated_at),+ updated_at: Some(refund.modified_at),connector: refund.connector,merchant_connector_id: refund.merchant_connector_id,charges: refund.charges,diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rsindex c5edd863ca..a36af01471 100644--- a/crates/router/src/db/refund.rs+++ b/crates/router/src/db/refund.rs@@ -273,7 +273,7 @@ mod storage {#[cfg(feature = "kv_store")]mod storage {- use common_utils::{date_time, ext_traits::Encode, fallback_reverse_lookup_not_found};+ use common_utils::{ext_traits::Encode, fallback_reverse_lookup_not_found};use error_stack::{report, ResultExt};use redis_interface::HsetnxReply;use router_env::{instrument, tracing};@@ -389,8 +389,8 @@ mod storage {refund_error_code: None,metadata: new.metadata.clone(),refund_arn: new.refund_arn.clone(),- created_at: new.created_at.unwrap_or_else(date_time::now),- updated_at: new.created_at.unwrap_or_else(date_time::now),+ created_at: new.created_at,+ modified_at: new.created_at,description: new.description.clone(),refund_reason: new.refund_reason.clone(),profile_id: new.profile_id.clone(),@@ -844,8 +844,8 @@ impl RefundInterface for MockDb {refund_error_code: None,metadata: new.metadata,refund_arn: new.refund_arn.clone(),- created_at: new.created_at.unwrap_or(current_time),- updated_at: current_time,+ created_at: new.created_at,+ modified_at: current_time,description: new.description,refund_reason: new.refund_reason.clone(),profile_id: new.profile_id,diff --git a/crates/router/src/services/kafka/refund.rs b/crates/router/src/services/kafka/refund.rsindex d5ef71bf65..14b317b52e 100644--- a/crates/router/src/services/kafka/refund.rs+++ b/crates/router/src/services/kafka/refund.rs@@ -50,7 +50,7 @@ impl<'a> KafkaRefund<'a> {refund_error_message: refund.refund_error_message.as_ref(),refund_arn: refund.refund_arn.as_ref(),created_at: refund.created_at.assume_utc(),- modified_at: refund.updated_at.assume_utc(),+ modified_at: refund.modified_at.assume_utc(),description: refund.description.as_ref(),attempt_id: &refund.attempt_id,refund_reason: refund.refund_reason.as_ref(),diff --git a/crates/router/src/services/kafka/refund_event.rs b/crates/router/src/services/kafka/refund_event.rsindex 6aa80b243c..fea0b8c45e 100644--- a/crates/router/src/services/kafka/refund_event.rs+++ b/crates/router/src/services/kafka/refund_event.rs@@ -51,7 +51,7 @@ impl<'a> KafkaRefundEvent<'a> {refund_error_message: refund.refund_error_message.as_ref(),refund_arn: refund.refund_arn.as_ref(),created_at: refund.created_at.assume_utc(),- modified_at: refund.updated_at.assume_utc(),+ modified_at: refund.modified_at.assume_utc(),description: refund.description.as_ref(),attempt_id: &refund.attempt_id,refund_reason: refund.refund_reason.as_ref(),diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rsindex 4a6c76aab7..b817d3e1cd 100644--- a/crates/router/src/utils/user/sample_data.rs+++ b/crates/router/src/utils/user/sample_data.rs@@ -263,14 +263,49 @@ pub async fn generate_sample_data(_ => None,},confirm: true,- created_at: Some(created_at),- modified_at: Some(modified_at),+ created_at,+ modified_at,last_synced: Some(last_synced),amount_to_capture: Some(amount * 100),connector_response_reference_id: Some(attempt_id.clone()),updated_by: merchant_from_db.storage_scheme.to_string(),-- ..Default::default()+ save_to_locker: None,+ offer_amount: None,+ surcharge_amount: None,+ tax_amount: None,+ payment_method_id: None,+ capture_method: None,+ capture_on: None,+ cancellation_reason: None,+ mandate_id: None,+ browser_info: None,+ payment_token: None,+ connector_metadata: None,+ payment_experience: None,+ payment_method_data: None,+ business_sub_label: None,+ straight_through_algorithm: None,+ preprocessing_step_id: None,+ mandate_details: None,+ error_reason: None,+ multiple_capture_count: None,+ amount_capturable: i64::default(),+ merchant_connector_id: None,+ authentication_data: None,+ encoded_data: None,+ unified_code: None,+ unified_message: None,+ net_amount: None,+ external_three_ds_authentication_attempted: None,+ authentication_connector: None,+ authentication_id: None,+ mandate_data: None,+ payment_method_billing_address_id: None,+ fingerprint_id: None,+ charge_id: None,+ client_source: None,+ client_version: None,+ customer_acceptance: None,};let refund = if refunds_count < number_of_refunds && !is_failed_payment {@@ -285,8 +320,8 @@ pub async fn generate_sample_data(connector_transaction_id: attempt_id.clone(),connector_refund_id: None,description: Some("This is a sample refund".to_string()),- created_at: Some(created_at),- modified_at: Some(modified_at),+ created_at,+ modified_at,refund_reason: Some("Sample Refund".to_string()),connector: payment_attempt.connectordiff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rsindex 7a56cae174..a5b1e90259 100644--- a/crates/storage_impl/src/payments/payment_attempt.rs+++ b/crates/storage_impl/src/payments/payment_attempt.rs@@ -1303,8 +1303,10 @@ impl DataModelExt for PaymentAttemptNew {capture_on: self.capture_on,confirm: self.confirm,authentication_type: self.authentication_type,- created_at: self.created_at,- modified_at: self.modified_at,+ created_at: self.created_at.unwrap_or_else(common_utils::date_time::now),+ modified_at: self+ .modified_at+ .unwrap_or_else(common_utils::date_time::now),last_synced: self.last_synced,cancellation_reason: self.cancellation_reason,amount_to_capture: self@@ -1367,8 +1369,8 @@ impl DataModelExt for PaymentAttemptNew {capture_on: storage_model.capture_on,confirm: storage_model.confirm,authentication_type: storage_model.authentication_type,- created_at: storage_model.created_at,- modified_at: storage_model.modified_at,+ created_at: Some(storage_model.created_at),+ modified_at: Some(storage_model.modified_at),last_synced: storage_model.last_synced,cancellation_reason: storage_model.cancellation_reason,amount_to_capture: storage_model.amount_to_capture.map(MinorUnit::new),diff --git a/crates/storage_impl/src/payouts/payouts.rs b/crates/storage_impl/src/payouts/payouts.rsindex 69005a27a8..7a9dba0f20 100644--- a/crates/storage_impl/src/payouts/payouts.rs+++ b/crates/storage_impl/src/payouts/payouts.rs@@ -746,8 +746,10 @@ impl DataModelExt for PayoutsNew {return_url: self.return_url,entity_type: self.entity_type,metadata: self.metadata,- created_at: self.created_at,- last_modified_at: self.last_modified_at,+ created_at: self.created_at.unwrap_or_else(common_utils::date_time::now),+ last_modified_at: self+ .last_modified_at+ .unwrap_or_else(common_utils::date_time::now),profile_id: self.profile_id,status: self.status,attempt_count: self.attempt_count,@@ -775,8 +777,8 @@ impl DataModelExt for PayoutsNew {return_url: storage_model.return_url,entity_type: storage_model.entity_type,metadata: storage_model.metadata,- created_at: storage_model.created_at,- last_modified_at: storage_model.last_modified_at,+ created_at: Some(storage_model.created_at),+ last_modified_at: Some(storage_model.last_modified_at),profile_id: storage_model.profile_id,status: storage_model.status,attempt_count: storage_model.attempt_count,