feat(payment_methods_v2): Implemented Diesel and Domain models for v2 (#5700)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sarthak Soni
2024-09-04 18:00:42 +05:30
committed by GitHub
parent 1c39cc1262
commit c3cc887ea3
39 changed files with 2712 additions and 668 deletions

View File

@ -406,6 +406,10 @@ impl UniqueConstraints for diesel_models::PayoutAttempt {
}
}
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "payment_methods_v2")
))]
impl UniqueConstraints for diesel_models::PaymentMethod {
fn unique_constraints(&self) -> Vec<String> {
vec![format!("paymentmethod_{}", self.payment_method_id)]
@ -415,6 +419,16 @@ impl UniqueConstraints for diesel_models::PaymentMethod {
}
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
impl UniqueConstraints for diesel_models::PaymentMethod {
fn unique_constraints(&self) -> Vec<String> {
vec![format!("paymentmethod_{}", self.id)]
}
fn table_name(&self) -> &str {
"PaymentMethod"
}
}
impl UniqueConstraints for diesel_models::Mandate {
fn unique_constraints(&self) -> Vec<String> {
vec![format!(

View File

@ -32,7 +32,7 @@ pub enum PartitionKey<'a> {
},
MerchantIdCustomerId {
merchant_id: &'a common_utils::id_type::MerchantId,
customer_id: &'a str,
customer_id: &'a common_utils::id_type::CustomerId,
},
#[cfg(all(feature = "v2", feature = "customer_v2"))]
MerchantIdMerchantReferenceId {
@ -73,8 +73,9 @@ impl<'a> std::fmt::Display for PartitionKey<'a> {
merchant_id,
customer_id,
} => f.write_str(&format!(
"mid_{}_cust_{customer_id}",
merchant_id.get_string_repr()
"mid_{}_cust_{}",
merchant_id.get_string_repr(),
customer_id.get_string_repr()
)),
#[cfg(all(feature = "v2", feature = "customer_v2"))]
PartitionKey::MerchantIdMerchantReferenceId {