mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
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:
@ -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!(
|
||||
|
||||
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user