mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
fix: introduce net_amount field in payment response (#3115)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -97,7 +97,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
#[allow(clippy::as_conversions)]
|
||||
let id = payment_attempts.len() as i32;
|
||||
let time = common_utils::date_time::now();
|
||||
|
||||
let payment_attempt = payment_attempt.populate_derived_fields();
|
||||
let payment_attempt = PaymentAttempt {
|
||||
id,
|
||||
payment_id: payment_attempt.payment_id,
|
||||
@ -105,6 +105,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
attempt_id: payment_attempt.attempt_id,
|
||||
status: payment_attempt.status,
|
||||
amount: payment_attempt.amount,
|
||||
net_amount: payment_attempt.net_amount,
|
||||
currency: payment_attempt.currency,
|
||||
save_to_locker: payment_attempt.save_to_locker,
|
||||
connector: payment_attempt.connector,
|
||||
|
||||
@ -331,6 +331,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
MerchantStorageScheme::RedisKv => {
|
||||
let payment_attempt = payment_attempt.populate_derived_fields();
|
||||
let key = format!(
|
||||
"mid_{}_pid_{}",
|
||||
payment_attempt.merchant_id, payment_attempt.payment_id
|
||||
@ -343,6 +344,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
|
||||
attempt_id: payment_attempt.attempt_id.clone(),
|
||||
status: payment_attempt.status,
|
||||
amount: payment_attempt.amount,
|
||||
net_amount: payment_attempt.net_amount,
|
||||
currency: payment_attempt.currency,
|
||||
save_to_locker: payment_attempt.save_to_locker,
|
||||
connector: payment_attempt.connector.clone(),
|
||||
@ -1035,6 +1037,7 @@ impl DataModelExt for PaymentAttempt {
|
||||
attempt_id: self.attempt_id,
|
||||
status: self.status,
|
||||
amount: self.amount,
|
||||
net_amount: Some(self.net_amount),
|
||||
currency: self.currency,
|
||||
save_to_locker: self.save_to_locker,
|
||||
connector: self.connector,
|
||||
@ -1081,6 +1084,7 @@ impl DataModelExt for PaymentAttempt {
|
||||
|
||||
fn from_storage_model(storage_model: Self::StorageModel) -> Self {
|
||||
Self {
|
||||
net_amount: storage_model.get_or_calculate_net_amount(),
|
||||
id: storage_model.id,
|
||||
payment_id: storage_model.payment_id,
|
||||
merchant_id: storage_model.merchant_id,
|
||||
@ -1139,6 +1143,7 @@ impl DataModelExt for PaymentAttemptNew {
|
||||
|
||||
fn to_storage_model(self) -> Self::StorageModel {
|
||||
DieselPaymentAttemptNew {
|
||||
net_amount: Some(self.net_amount),
|
||||
payment_id: self.payment_id,
|
||||
merchant_id: self.merchant_id,
|
||||
attempt_id: self.attempt_id,
|
||||
@ -1189,6 +1194,7 @@ impl DataModelExt for PaymentAttemptNew {
|
||||
|
||||
fn from_storage_model(storage_model: Self::StorageModel) -> Self {
|
||||
Self {
|
||||
net_amount: storage_model.get_or_calculate_net_amount(),
|
||||
payment_id: storage_model.payment_id,
|
||||
merchant_id: storage_model.merchant_id,
|
||||
attempt_id: storage_model.attempt_id,
|
||||
|
||||
Reference in New Issue
Block a user