mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
refactor(merchant_id): create domain type for merchant_id (#5408)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
This commit is contained in:
@ -330,7 +330,11 @@ impl UniqueConstraints for diesel_models::Address {
|
||||
|
||||
impl UniqueConstraints for diesel_models::PaymentIntent {
|
||||
fn unique_constraints(&self) -> Vec<String> {
|
||||
vec![format!("pi_{}_{}", self.merchant_id, self.payment_id)]
|
||||
vec![format!(
|
||||
"pi_{}_{}",
|
||||
self.merchant_id.get_string_repr(),
|
||||
self.payment_id
|
||||
)]
|
||||
}
|
||||
fn table_name(&self) -> &str {
|
||||
"PaymentIntent"
|
||||
@ -341,7 +345,9 @@ impl UniqueConstraints for diesel_models::PaymentAttempt {
|
||||
fn unique_constraints(&self) -> Vec<String> {
|
||||
vec![format!(
|
||||
"pa_{}_{}_{}",
|
||||
self.merchant_id, self.payment_id, self.attempt_id
|
||||
self.merchant_id.get_string_repr(),
|
||||
self.payment_id,
|
||||
self.attempt_id
|
||||
)]
|
||||
}
|
||||
fn table_name(&self) -> &str {
|
||||
@ -351,7 +357,11 @@ impl UniqueConstraints for diesel_models::PaymentAttempt {
|
||||
|
||||
impl UniqueConstraints for diesel_models::Refund {
|
||||
fn unique_constraints(&self) -> Vec<String> {
|
||||
vec![format!("refund_{}_{}", self.merchant_id, self.refund_id)]
|
||||
vec![format!(
|
||||
"refund_{}_{}",
|
||||
self.merchant_id.get_string_repr(),
|
||||
self.refund_id
|
||||
)]
|
||||
}
|
||||
fn table_name(&self) -> &str {
|
||||
"Refund"
|
||||
@ -370,7 +380,11 @@ impl UniqueConstraints for diesel_models::ReverseLookup {
|
||||
#[cfg(feature = "payouts")]
|
||||
impl UniqueConstraints for diesel_models::Payouts {
|
||||
fn unique_constraints(&self) -> Vec<String> {
|
||||
vec![format!("po_{}_{}", self.merchant_id, self.payout_id)]
|
||||
vec![format!(
|
||||
"po_{}_{}",
|
||||
self.merchant_id.get_string_repr(),
|
||||
self.payout_id
|
||||
)]
|
||||
}
|
||||
fn table_name(&self) -> &str {
|
||||
"Payouts"
|
||||
@ -382,7 +396,8 @@ impl UniqueConstraints for diesel_models::PayoutAttempt {
|
||||
fn unique_constraints(&self) -> Vec<String> {
|
||||
vec![format!(
|
||||
"poa_{}_{}",
|
||||
self.merchant_id, self.payout_attempt_id
|
||||
self.merchant_id.get_string_repr(),
|
||||
self.payout_attempt_id
|
||||
)]
|
||||
}
|
||||
fn table_name(&self) -> &str {
|
||||
@ -401,7 +416,11 @@ impl UniqueConstraints for diesel_models::PaymentMethod {
|
||||
|
||||
impl UniqueConstraints for diesel_models::Mandate {
|
||||
fn unique_constraints(&self) -> Vec<String> {
|
||||
vec![format!("mand_{}_{}", self.merchant_id, self.mandate_id)]
|
||||
vec![format!(
|
||||
"mand_{}_{}",
|
||||
self.merchant_id.get_string_repr(),
|
||||
self.mandate_id
|
||||
)]
|
||||
}
|
||||
fn table_name(&self) -> &str {
|
||||
"Mandate"
|
||||
@ -413,7 +432,7 @@ impl UniqueConstraints for diesel_models::Customer {
|
||||
vec![format!(
|
||||
"customer_{}_{}",
|
||||
self.customer_id.get_string_repr(),
|
||||
self.merchant_id
|
||||
self.merchant_id.get_string_repr(),
|
||||
)]
|
||||
}
|
||||
fn table_name(&self) -> &str {
|
||||
|
||||
Reference in New Issue
Block a user