Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor(organization): add api version column (#7418)

Aishwariyaa Anandbfb6f59a798b
diff --git a/Cargo.lock b/Cargo.lock
index debcaf5d28..f0026e2d29 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6960,6 +6960,7 @@ name = "scheduler"
version = "0.1.0"
dependencies = [
"async-trait",
+ "common_types",
"common_utils",
"diesel_models",
"error-stack",
diff --git a/crates/common_types/src/consts.rs b/crates/common_types/src/consts.rs
new file mode 100644
index 0000000000..3550333443
--- /dev/null
+++ b/crates/common_types/src/consts.rs
@@ -0,0 +1,9 @@
+//! Constants that are used in the domain level.
+
+/// API version
+#[cfg(feature = "v1")]
+pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V1;
+
+/// API version
+#[cfg(feature = "v2")]
+pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V2;
diff --git a/crates/common_types/src/lib.rs b/crates/common_types/src/lib.rs
index 589a77e3a5..7f3b44ecd9 100644
--- a/crates/common_types/src/lib.rs
+++ b/crates/common_types/src/lib.rs
@@ -2,6 +2,7 @@
#![warn(missing_docs, missing_debug_implementations)]
+pub mod consts;
pub mod customers;
pub mod domain;
pub mod payment_methods;
diff --git a/crates/diesel_models/Cargo.toml b/crates/diesel_models/Cargo.toml
index 9491357139..ca7e85628b 100644
--- a/crates/diesel_models/Cargo.toml
+++ b/crates/diesel_models/Cargo.toml
@@ -10,8 +10,8 @@ license.workspace = true
[features]
default = ["kv_store"]
kv_store = []
-v1 = ["common_utils/v1"]
-v2 = ["common_utils/v2"]
+v1 = ["common_utils/v1", "common_types/v1"]
+v2 = ["common_utils/v2", "common_types/v2"]
customer_v2 = []
payment_methods_v2 = []
refunds_v2 = []
diff --git a/crates/diesel_models/src/organization.rs b/crates/diesel_models/src/organization.rs
index 753f1cf3c3..1ca8622593 100644
--- a/crates/diesel_models/src/organization.rs
+++ b/crates/diesel_models/src/organization.rs
@@ -28,6 +28,7 @@ pub struct Organization {
id: Option<id_type::OrganizationId>,
#[allow(dead_code)]
organization_name: Option<String>,
+ pub version: common_enums::ApiVersion,
}
#[cfg(feature = "v2")]
@@ -44,6 +45,7 @@ pub struct Organization {
pub modified_at: time::PrimitiveDateTime,
id: id_type::OrganizationId,
organization_name: Option<String>,
+ pub version: common_enums::ApiVersion,
}
#[cfg(feature = "v1")]
@@ -58,6 +60,7 @@ impl Organization {
modified_at,
id: _,
organization_name: _,
+ version,
} = org_new;
Self {
id: Some(org_id.clone()),
@@ -68,6 +71,7 @@ impl Organization {
metadata,
created_at,
modified_at,
+ version,
}
}
}
@@ -82,6 +86,7 @@ impl Organization {
metadata,
created_at,
modified_at,
+ version,
} = org_new;
Self {
id,
@@ -90,6 +95,7 @@ impl Organization {
metadata,
created_at,
modified_at,
+ version,
}
}
}
@@ -106,6 +112,7 @@ pub struct OrganizationNew {
pub metadata: Option<pii::SecretSerdeValue>,
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
+ pub version: common_enums::ApiVersion,
}
#[cfg(feature = "v2")]
@@ -118,6 +125,7 @@ pub struct OrganizationNew {
pub metadata: Option<pii::SecretSerdeValue>,
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
+ pub version: common_enums::ApiVersion,
}
#[cfg(feature = "v1")]
@@ -132,6 +140,7 @@ impl OrganizationNew {
metadata: None,
created_at: common_utils::date_time::now(),
modified_at: common_utils::date_time::now(),
+ version: common_types::consts::API_VERSION,
}
}
}
@@ -146,6 +155,7 @@ impl OrganizationNew {
metadata: None,
created_at: common_utils::date_time::now(),
modified_at: common_utils::date_time::now(),
+ version: common_types::consts::API_VERSION,
}
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 96f734da10..56a0b670e5 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -817,6 +817,7 @@ diesel::table! {
#[max_length = 32]
id -> Nullable<Varchar>,
organization_name -> Nullable<Text>,
+ version -> ApiVersion,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index dea417f36d..4ab5b5377e 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -796,6 +796,7 @@ diesel::table! {
#[max_length = 32]
id -> Varchar,
organization_name -> Nullable<Text>,
+ version -> ApiVersion,
}
}
diff --git a/crates/hyperswitch_domain_models/Cargo.toml b/crates/hyperswitch_domain_models/Cargo.toml
index c27d1f6bf9..39aadb90db 100644
--- a/crates/hyperswitch_domain_models/Cargo.toml
+++ b/crates/hyperswitch_domain_models/Cargo.toml
@@ -13,8 +13,8 @@ encryption_service = []
olap = []
payouts = ["api_models/payouts"]
frm = ["api_models/frm"]
-v2 = ["api_models/v2", "diesel_models/v2", "common_utils/v2"]
-v1 = ["api_models/v1", "diesel_models/v1", "common_utils/v1"]
+v2 = ["api_models/v2", "diesel_models/v2", "common_utils/v2", "common_types/v2"]
+v1 = ["api_models/v1", "diesel_models/v1", "common_utils/v1", "common_types/v1"]
customer_v2 = ["api_models/customer_v2", "diesel_models/customer_v2"]
payment_methods_v2 = ["api_models/payment_methods_v2", "diesel_models/payment_methods_v2"]
dummy_connector = []
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index 5170bd3ce2..b7fa027bb0 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -15,10 +15,7 @@ use diesel_models::business_profile::{
use error_stack::ResultExt;
use masking::{PeekInterface, Secret};
-use crate::{
- consts,
- type_encryption::{crypto_operation, AsyncLift, CryptoOperation},
-};
+use crate::type_encryption::{crypto_operation, AsyncLift, CryptoOperation};
#[cfg(feature = "v1")]
#[derive(Clone, Debug)]
@@ -162,7 +159,7 @@ impl From<ProfileSetter> for Profile {
.always_collect_shipping_details_from_wallet_connector,
tax_connector_id: value.tax_connector_id,
is_tax_connector_enabled: value.is_tax_connector_enabled,
- version: consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
dynamic_routing_algorithm: value.dynamic_routing_algorithm,
is_network_tokenization_enabled: value.is_network_tokenization_enabled,
is_auto_retries_enabled: value.is_auto_retries_enabled,
@@ -993,7 +990,7 @@ impl From<ProfileSetter> for Profile {
should_collect_cvv_during_payment: value.should_collect_cvv_during_payment,
tax_connector_id: value.tax_connector_id,
is_tax_connector_enabled: value.is_tax_connector_enabled,
- version: consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
is_network_tokenization_enabled: value.is_network_tokenization_enabled,
is_click_to_pay_enabled: value.is_click_to_pay_enabled,
authentication_product_ids: value.authentication_product_ids,
diff --git a/crates/hyperswitch_domain_models/src/consts.rs b/crates/hyperswitch_domain_models/src/consts.rs
index c2ebd839fe..93fd63deb6 100644
--- a/crates/hyperswitch_domain_models/src/consts.rs
+++ b/crates/hyperswitch_domain_models/src/consts.rs
@@ -4,12 +4,6 @@ use std::collections::HashSet;
use router_env::once_cell::sync::Lazy;
-#[cfg(feature = "v1")]
-pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V1;
-
-#[cfg(feature = "v2")]
-pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V2;
-
pub static ROUTING_ENABLED_PAYMENT_METHODS: Lazy<HashSet<common_enums::PaymentMethod>> =
Lazy::new(|| {
let mut set = HashSet::new();
diff --git a/crates/hyperswitch_domain_models/src/customer.rs b/crates/hyperswitch_domain_models/src/customer.rs
index 384bc5ab42..65e17ace22 100644
--- a/crates/hyperswitch_domain_models/src/customer.rs
+++ b/crates/hyperswitch_domain_models/src/customer.rs
@@ -319,7 +319,7 @@ impl super::behaviour::Conversion for Customer {
updated_by: self.updated_by,
default_billing_address: self.default_billing_address,
default_shipping_address: self.default_shipping_address,
- version: crate::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
status: self.status,
})
}
diff --git a/crates/hyperswitch_domain_models/src/merchant_account.rs b/crates/hyperswitch_domain_models/src/merchant_account.rs
index fef000a395..8657af91c5 100644
--- a/crates/hyperswitch_domain_models/src/merchant_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_account.rs
@@ -572,7 +572,7 @@ impl super::behaviour::Conversion for MerchantAccount {
modified_at: self.modified_at,
organization_id: self.organization_id,
recon_status: self.recon_status,
- version: crate::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
is_platform_account: self.is_platform_account,
product_type: self.product_type,
};
@@ -657,7 +657,7 @@ impl super::behaviour::Conversion for MerchantAccount {
modified_at: now,
organization_id: self.organization_id,
recon_status: self.recon_status,
- version: crate::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
is_platform_account: self.is_platform_account,
product_type: self
.product_type
@@ -820,7 +820,7 @@ impl super::behaviour::Conversion for MerchantAccount {
recon_status: self.recon_status,
payment_link_config: self.payment_link_config,
pm_collect_link_config: self.pm_collect_link_config,
- version: crate::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
is_platform_account: self.is_platform_account,
product_type: self
.product_type
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index a984db7086..6be1be4b7d 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -402,7 +402,7 @@ impl MerchantAccountCreateBridge for api::MerchantAccountCreate {
recon_status: diesel_models::enums::ReconStatus::NotRequested,
payment_link_config: None,
pm_collect_link_config,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
is_platform_account: false,
product_type: self.product_type,
},
@@ -673,7 +673,7 @@ impl MerchantAccountCreateBridge for api::MerchantAccountCreate {
organization_id: organization.get_organization_id(),
recon_status: diesel_models::enums::ReconStatus::NotRequested,
is_platform_account: false,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
product_type: self.product_type,
}),
)
@@ -2608,7 +2608,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {
status: connector_status,
connector_wallets_details: encrypted_data.connector_wallets_details,
additional_merchant_data: encrypted_data.additional_merchant_data,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
feature_metadata,
})
}
@@ -2813,7 +2813,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {
business_label: self.business_label.clone(),
business_sub_label: self.business_sub_label.clone(),
additional_merchant_data: encrypted_data.additional_merchant_data,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
})
}
diff --git a/crates/router/src/core/api_keys.rs b/crates/router/src/core/api_keys.rs
index bb970a4956..d76b338dc3 100644
--- a/crates/router/src/core/api_keys.rs
+++ b/crates/router/src/core/api_keys.rs
@@ -230,7 +230,7 @@ pub async fn add_api_key_expiry_task(
api_key_expiry_tracker,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct API key expiry process tracker task")?;
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index e9d9ffe2d7..c46cadd1e3 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -188,7 +188,7 @@ impl CustomerCreateBridge for customers::CustomerRequest {
modified_at: common_utils::date_time::now(),
default_payment_method_id: None,
updated_by: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
})
}
@@ -284,7 +284,7 @@ impl CustomerCreateBridge for customers::CustomerRequest {
updated_by: None,
default_billing_address: encrypted_customer_billing_address.map(Into::into),
default_shipping_address: encrypted_customer_shipping_address.map(Into::into),
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
status: common_enums::DeleteStatus::Active,
})
}
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index f4ff34a296..fee2061e67 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -495,7 +495,7 @@ pub async fn add_payment_method_status_update_task(
tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct PAYMENT_METHOD_STATUS_UPDATE process tracker task")?;
@@ -1550,7 +1550,7 @@ pub async fn create_payment_method_for_intent(
last_used_at: current_time,
payment_method_billing_address,
updated_by: None,
- version: domain::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
locker_fingerprint_id: None,
network_token_locker_id: None,
network_token_payment_method_data: None,
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 12e9c6e16e..dc79cd6845 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -205,7 +205,7 @@ pub async fn create_payment_method(
last_used_at: current_time,
payment_method_billing_address,
updated_by: None,
- version: domain::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
network_token_requestor_reference_id,
network_token_locker_id,
network_token_payment_method_data,
@@ -828,7 +828,7 @@ pub async fn skip_locker_call_and_migrate_payment_method(
last_used_at: current_time,
payment_method_billing_address,
updated_by: None,
- version: domain::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
network_token_requestor_reference_id: None,
network_token_locker_id: None,
network_token_payment_method_data: None,
diff --git a/crates/router/src/core/payment_methods/tokenize/card_executor.rs b/crates/router/src/core/payment_methods/tokenize/card_executor.rs
index 9b7f89c519..eb9d3d6b6c 100644
--- a/crates/router/src/core/payment_methods/tokenize/card_executor.rs
+++ b/crates/router/src/core/payment_methods/tokenize/card_executor.rs
@@ -422,7 +422,7 @@ impl CardNetworkTokenizeExecutor<'_, domain::TokenizeCardRequest> {
address_id: None,
default_payment_method_id: None,
updated_by: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
};
db.insert_customer(
diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rs
index 8181df8c05..71d57ef796 100644
--- a/crates/router/src/core/payment_methods/vault.rs
+++ b/crates/router/src/core/payment_methods/vault.rs
@@ -1401,7 +1401,7 @@ pub async fn add_delete_tokenized_data_task(
tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct delete tokenized data process tracker task")?;
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index e80c281fa4..88e5cc7481 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -5967,7 +5967,7 @@ pub async fn add_process_sync_task(
tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.map_err(errors::StorageError::from)?;
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 5146863a28..190347dfe3 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1801,7 +1801,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, D>(
address_id: None,
default_payment_method_id: None,
updated_by: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
};
metrics::CUSTOMER_CREATED.add(1, &[]);
db.insert_customer(new_customer, key_manager_state, key_store, storage_scheme)
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 21a560e781..7ddce4ccc1 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -3094,7 +3094,7 @@ pub async fn add_external_account_addition_task(
tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.map_err(errors::StorageError::from)?;
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 45bd954190..cdb021311e 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -776,7 +776,7 @@ pub(super) async fn get_or_create_customer_details(
address_id: None,
default_payment_method_id: None,
updated_by: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
};
Ok(Some(
diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs
index 0577b532cf..eddacce99b 100644
--- a/crates/router/src/core/pm_auth.rs
+++ b/crates/router/src/core/pm_auth.rs
@@ -550,7 +550,7 @@ async fn store_bank_details_in_payment_methods(
client_secret: None,
payment_method_billing_address: None,
updated_by: None,
- version: domain::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
network_token_requestor_reference_id: None,
network_token_locker_id: None,
network_token_payment_method_data: None,
@@ -577,7 +577,7 @@ async fn store_bank_details_in_payment_methods(
payment_method_billing_address: None,
updated_by: None,
locker_fingerprint_id: None,
- version: domain::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
network_token_requestor_reference_id: None,
network_token_locker_id: None,
network_token_payment_method_data: None,
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 7d663a48a1..e81c7d025a 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -1621,7 +1621,7 @@ pub async fn add_refund_sync_task(
refund_workflow_tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct refund sync process tracker task")?;
@@ -1660,7 +1660,7 @@ pub async fn add_refund_execute_task(
refund_workflow_tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct refund execute process tracker task")?;
diff --git a/crates/router/src/core/revenue_recovery.rs b/crates/router/src/core/revenue_recovery.rs
index b5d5e7a6cd..b558bd8cbc 100644
--- a/crates/router/src/core/revenue_recovery.rs
+++ b/crates/router/src/core/revenue_recovery.rs
@@ -163,7 +163,7 @@ async fn insert_psync_pcr_task(
psync_workflow_tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to construct delete tokenized data process tracker task")?;
diff --git a/crates/router/src/core/webhooks/outgoing.rs b/crates/router/src/core/webhooks/outgoing.rs
index 92c29282b2..71b4e822a3 100644
--- a/crates/router/src/core/webhooks/outgoing.rs
+++ b/crates/router/src/core/webhooks/outgoing.rs
@@ -555,7 +555,7 @@ pub(crate) async fn add_outgoing_webhook_retry_task_to_process_tracker(
tracking_data,
None,
schedule_time,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.map_err(errors::StorageError::from)?;
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index 92683beb28..213c2b19f6 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -1680,7 +1680,7 @@ mod merchant_connector_account_cache_tests {
.unwrap(),
),
additional_merchant_data: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
};
db.insert_merchant_connector_account(key_manager_state, mca.clone(), &merchant_key)
@@ -1858,7 +1858,7 @@ mod merchant_connector_account_cache_tests {
.unwrap(),
),
additional_merchant_data: None,
- version: hyperswitch_domain_models::consts::API_VERSION,
+ version: common_types::consts::API_VERSION,
feature_metadata: None,
};
diff --git a/crates/scheduler/Cargo.toml b/crates/scheduler/Cargo.toml
index 176a4a99b2..5c2bc868ab 100644
--- a/crates/scheduler/Cargo.toml
+++ b/crates/scheduler/Cargo.toml
@@ -10,8 +10,8 @@ default = ["kv_store", "olap"]
olap = ["storage_impl/olap", "hyperswitch_domain_models/olap"]
kv_store = []
email = ["external_services/email"]
-v1 = ["diesel_models/v1", "hyperswitch_domain_models/v1", "storage_impl/v1", "common_utils/v1"]
-v2 = ["diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "common_utils/v2"]
+v1 = ["diesel_models/v1", "hyperswitch_domain_models/v1", "storage_impl/v1", "common_utils/v1", "common_types/v1"]
+v2 = ["diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "common_utils/v2", "common_types/v2"]
[dependencies]
# Third party crates
@@ -31,6 +31,7 @@ uuid = { version = "1.8.0", features = ["v4"] }
# First party crates
common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals", "async_ext"] }
+common_types = { version = "0.1.0", path = "../common_types" }
diesel_models = { version = "0.1.0", path = "../diesel_models", features = ["kv_store"], default-features = false }
external_services = { version = "0.1.0", path = "../external_services" }
hyperswitch_domain_models = { version = "0.1.0", path = "../hyperswitch_domain_models", default-features = false }
diff --git a/crates/scheduler/src/db/process_tracker.rs b/crates/scheduler/src/db/process_tracker.rs
index 4cf516faa1..1d72197376 100644
--- a/crates/scheduler/src/db/process_tracker.rs
+++ b/crates/scheduler/src/db/process_tracker.rs
@@ -101,7 +101,7 @@ impl ProcessTrackerInterface for Store {
time_upper_limit,
status,
limit,
- hyperswitch_domain_models::consts::API_VERSION,
+ common_types::consts::API_VERSION,
)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
diff --git a/migrations/2025-03-04-053541_add_api_version_to_organization/down.sql b/migrations/2025-03-04-053541_add_api_version_to_organization/down.sql
new file mode 100644
index 0000000000..4e492ad0ef
--- /dev/null
+++ b/migrations/2025-03-04-053541_add_api_version_to_organization/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE organization DROP COLUMN version;
diff --git a/migrations/2025-03-04-053541_add_api_version_to_organization/up.sql b/migrations/2025-03-04-053541_add_api_version_to_organization/up.sql
new file mode 100644
index 0000000000..1569b53f9d
--- /dev/null
+++ b/migrations/2025-03-04-053541_add_api_version_to_organization/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE organization
+ADD COLUMN IF NOT EXISTS version "ApiVersion" NOT NULL DEFAULT 'v1';
\ No newline at end of file