feat(database): add profile & organisation id to transaction tables (#5696)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sampras Lopes
2024-08-29 15:06:44 +05:30
committed by GitHub
parent a6cb6c6e68
commit 2049ab0554
39 changed files with 553 additions and 92 deletions

View File

@ -158,6 +158,8 @@ impl PaymentAttemptInterface for MockDb {
client_source: payment_attempt.client_source,
client_version: payment_attempt.client_version,
customer_acceptance: payment_attempt.customer_acceptance,
organization_id: payment_attempt.organization_id,
profile_id: payment_attempt.profile_id,
};
payment_attempts.push(payment_attempt.clone());
Ok(payment_attempt)

View File

@ -419,6 +419,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
client_source: payment_attempt.client_source.clone(),
client_version: payment_attempt.client_version.clone(),
customer_acceptance: payment_attempt.customer_acceptance.clone(),
organization_id: payment_attempt.organization_id.clone(),
profile_id: payment_attempt.profile_id.clone(),
};
let field = format!("pa_{}", created_attempt.attempt_id);
@ -1189,6 +1191,15 @@ impl DataModelExt for PaymentAttempt {
connector_metadata: self.connector_metadata,
payment_experience: self.payment_experience,
payment_method_type: self.payment_method_type,
card_network: self
.payment_method_data
.as_ref()
.and_then(|data| data.as_object())
.and_then(|card| card.get("card"))
.and_then(|data| data.as_object())
.and_then(|card| card.get("card_network"))
.and_then(|network| network.as_str())
.map(|network| network.to_string()),
payment_method_data: self.payment_method_data,
business_sub_label: self.business_sub_label,
straight_through_algorithm: self.straight_through_algorithm,
@ -1215,6 +1226,8 @@ impl DataModelExt for PaymentAttempt {
client_source: self.client_source,
client_version: self.client_version,
customer_acceptance: self.customer_acceptance,
organization_id: self.organization_id,
profile_id: self.profile_id,
}
}
@ -1282,6 +1295,8 @@ impl DataModelExt for PaymentAttempt {
client_source: storage_model.client_source,
client_version: storage_model.client_version,
customer_acceptance: storage_model.customer_acceptance,
organization_id: storage_model.organization_id,
profile_id: storage_model.profile_id,
}
}
}
@ -1330,6 +1345,15 @@ impl DataModelExt for PaymentAttempt {
connector_metadata: self.connector_metadata,
payment_experience: self.payment_experience,
payment_method_type: self.payment_method_type,
card_network: self
.payment_method_data
.as_ref()
.and_then(|data| data.as_object())
.and_then(|card| card.get("card"))
.and_then(|data| data.as_object())
.and_then(|card| card.get("card_network"))
.and_then(|network| network.as_str())
.map(|network| network.to_string()),
payment_method_data: self.payment_method_data,
business_sub_label: self.business_sub_label,
straight_through_algorithm: self.straight_through_algorithm,
@ -1356,6 +1380,8 @@ impl DataModelExt for PaymentAttempt {
client_source: self.client_source,
client_version: self.client_version,
customer_acceptance: self.customer_acceptance,
organization_id: self.organization_id,
profile_id: self.profile_id,
}
}
@ -1423,6 +1449,8 @@ impl DataModelExt for PaymentAttempt {
client_source: storage_model.client_source,
client_version: storage_model.client_version,
customer_acceptance: storage_model.customer_acceptance,
organization_id: storage_model.organization_id,
profile_id: storage_model.profile_id,
}
}
}
@ -1471,6 +1499,15 @@ impl DataModelExt for PaymentAttemptNew {
connector_metadata: self.connector_metadata,
payment_experience: self.payment_experience,
payment_method_type: self.payment_method_type,
card_network: self
.payment_method_data
.as_ref()
.and_then(|data| data.as_object())
.and_then(|card| card.get("card"))
.and_then(|value| value.as_object())
.and_then(|map| map.get("card_network"))
.and_then(|network| network.as_str())
.map(|network| network.to_string()),
payment_method_data: self.payment_method_data,
business_sub_label: self.business_sub_label,
straight_through_algorithm: self.straight_through_algorithm,
@ -1497,6 +1534,8 @@ impl DataModelExt for PaymentAttemptNew {
client_source: self.client_source,
client_version: self.client_version,
customer_acceptance: self.customer_acceptance,
organization_id: self.organization_id,
profile_id: self.profile_id,
}
}
@ -1563,6 +1602,8 @@ impl DataModelExt for PaymentAttemptNew {
client_source: storage_model.client_source,
client_version: storage_model.client_version,
customer_acceptance: storage_model.customer_acceptance,
organization_id: storage_model.organization_id,
profile_id: storage_model.profile_id,
}
}
}