refactor(payment_intent_v2): payment intent fields refactoring (#5880)

Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2024-09-20 16:50:53 +05:30
committed by GitHub
parent 00e913c75c
commit 5335f2d21c
48 changed files with 2478 additions and 1620 deletions

View File

@ -332,12 +332,9 @@ impl UniqueConstraints for diesel_models::Address {
#[cfg(all(feature = "v2", feature = "payment_v2"))]
impl UniqueConstraints for diesel_models::PaymentIntent {
fn unique_constraints(&self) -> Vec<String> {
vec![format!(
"pi_{}_{}",
self.merchant_id.get_string_repr(),
self.merchant_reference_id
)]
vec![self.id.get_string_repr().to_owned()]
}
fn table_name(&self) -> &str {
"PaymentIntent"
}
@ -345,6 +342,7 @@ impl UniqueConstraints for diesel_models::PaymentIntent {
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "payment_v2")))]
impl UniqueConstraints for diesel_models::PaymentIntent {
#[cfg(feature = "v1")]
fn unique_constraints(&self) -> Vec<String> {
vec![format!(
"pi_{}_{}",
@ -352,6 +350,12 @@ impl UniqueConstraints for diesel_models::PaymentIntent {
self.payment_id.get_string_repr()
)]
}
#[cfg(feature = "v2")]
fn unique_constraints(&self) -> Vec<String> {
vec![format!("pi_{}", self.id.get_string_repr())]
}
fn table_name(&self) -> &str {
"PaymentIntent"
}
@ -437,7 +441,7 @@ 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![self.id.get_string_repr()]
vec![self.id.get_string_repr().to_owned()]
}
fn table_name(&self) -> &str {
"PaymentMethod"