mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
fix(core): update amount_capturable in update trackers (#2142)
This commit is contained in:
@ -216,6 +216,7 @@ pub enum PaymentAttemptUpdate {
|
|||||||
payment_token: Option<String>,
|
payment_token: Option<String>,
|
||||||
connector: Option<String>,
|
connector: Option<String>,
|
||||||
straight_through_algorithm: Option<serde_json::Value>,
|
straight_through_algorithm: Option<serde_json::Value>,
|
||||||
|
amount_capturable: Option<i64>,
|
||||||
},
|
},
|
||||||
AuthenticationTypeUpdate {
|
AuthenticationTypeUpdate {
|
||||||
authentication_type: storage_enums::AuthenticationType,
|
authentication_type: storage_enums::AuthenticationType,
|
||||||
@ -236,6 +237,7 @@ pub enum PaymentAttemptUpdate {
|
|||||||
straight_through_algorithm: Option<serde_json::Value>,
|
straight_through_algorithm: Option<serde_json::Value>,
|
||||||
error_code: Option<Option<String>>,
|
error_code: Option<Option<String>>,
|
||||||
error_message: Option<Option<String>>,
|
error_message: Option<Option<String>>,
|
||||||
|
amount_capturable: Option<i64>,
|
||||||
},
|
},
|
||||||
RejectUpdate {
|
RejectUpdate {
|
||||||
status: storage_enums::AttemptStatus,
|
status: storage_enums::AttemptStatus,
|
||||||
|
|||||||
@ -137,6 +137,7 @@ pub enum PaymentAttemptUpdate {
|
|||||||
payment_token: Option<String>,
|
payment_token: Option<String>,
|
||||||
connector: Option<String>,
|
connector: Option<String>,
|
||||||
straight_through_algorithm: Option<serde_json::Value>,
|
straight_through_algorithm: Option<serde_json::Value>,
|
||||||
|
amount_capturable: Option<i64>,
|
||||||
},
|
},
|
||||||
AuthenticationTypeUpdate {
|
AuthenticationTypeUpdate {
|
||||||
authentication_type: storage_enums::AuthenticationType,
|
authentication_type: storage_enums::AuthenticationType,
|
||||||
@ -157,6 +158,7 @@ pub enum PaymentAttemptUpdate {
|
|||||||
straight_through_algorithm: Option<serde_json::Value>,
|
straight_through_algorithm: Option<serde_json::Value>,
|
||||||
error_code: Option<Option<String>>,
|
error_code: Option<Option<String>>,
|
||||||
error_message: Option<Option<String>>,
|
error_message: Option<Option<String>>,
|
||||||
|
amount_capturable: Option<i64>,
|
||||||
},
|
},
|
||||||
VoidUpdate {
|
VoidUpdate {
|
||||||
status: storage_enums::AttemptStatus,
|
status: storage_enums::AttemptStatus,
|
||||||
@ -339,6 +341,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
|
|||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
error_code,
|
error_code,
|
||||||
error_message,
|
error_message,
|
||||||
|
amount_capturable,
|
||||||
} => Self {
|
} => Self {
|
||||||
amount: Some(amount),
|
amount: Some(amount),
|
||||||
currency: Some(currency),
|
currency: Some(currency),
|
||||||
@ -356,6 +359,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
|
|||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
error_code,
|
error_code,
|
||||||
error_message,
|
error_message,
|
||||||
|
amount_capturable,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
PaymentAttemptUpdate::VoidUpdate {
|
PaymentAttemptUpdate::VoidUpdate {
|
||||||
@ -432,10 +436,12 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
|
|||||||
payment_token,
|
payment_token,
|
||||||
connector,
|
connector,
|
||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
|
amount_capturable,
|
||||||
} => Self {
|
} => Self {
|
||||||
payment_token,
|
payment_token,
|
||||||
connector,
|
connector,
|
||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
|
amount_capturable,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
PaymentAttemptUpdate::UnresolvedResponseUpdate {
|
PaymentAttemptUpdate::UnresolvedResponseUpdate {
|
||||||
|
|||||||
@ -513,7 +513,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
|
|||||||
.take();
|
.take();
|
||||||
let order_details = payment_data.payment_intent.order_details.clone();
|
let order_details = payment_data.payment_intent.order_details.clone();
|
||||||
let metadata = payment_data.payment_intent.metadata.clone();
|
let metadata = payment_data.payment_intent.metadata.clone();
|
||||||
|
let authorized_amount = payment_data.payment_attempt.amount;
|
||||||
let payment_attempt_fut = db
|
let payment_attempt_fut = db
|
||||||
.update_payment_attempt_with_attempt_id(
|
.update_payment_attempt_with_attempt_id(
|
||||||
payment_data.payment_attempt,
|
payment_data.payment_attempt,
|
||||||
@ -533,6 +533,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
|
|||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
error_code,
|
error_code,
|
||||||
error_message,
|
error_message,
|
||||||
|
amount_capturable: Some(authorized_amount),
|
||||||
},
|
},
|
||||||
storage_scheme,
|
storage_scheme,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -386,6 +386,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
|
|||||||
.payment_attempt
|
.payment_attempt
|
||||||
.straight_through_algorithm
|
.straight_through_algorithm
|
||||||
.clone();
|
.clone();
|
||||||
|
let authorized_amount = payment_data.payment_attempt.amount;
|
||||||
|
|
||||||
payment_data.payment_attempt = db
|
payment_data.payment_attempt = db
|
||||||
.update_payment_attempt_with_attempt_id(
|
.update_payment_attempt_with_attempt_id(
|
||||||
@ -394,6 +395,10 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
|
|||||||
payment_token,
|
payment_token,
|
||||||
connector,
|
connector,
|
||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
|
amount_capturable: match payment_data.confirm.unwrap_or(true) {
|
||||||
|
true => Some(authorized_amount),
|
||||||
|
false => None,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
storage_scheme,
|
storage_scheme,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1089,10 +1089,12 @@ impl DataModelExt for PaymentAttemptUpdate {
|
|||||||
payment_token,
|
payment_token,
|
||||||
connector,
|
connector,
|
||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
|
amount_capturable,
|
||||||
} => DieselPaymentAttemptUpdate::UpdateTrackers {
|
} => DieselPaymentAttemptUpdate::UpdateTrackers {
|
||||||
payment_token,
|
payment_token,
|
||||||
connector,
|
connector,
|
||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
|
amount_capturable,
|
||||||
},
|
},
|
||||||
Self::AuthenticationTypeUpdate {
|
Self::AuthenticationTypeUpdate {
|
||||||
authentication_type,
|
authentication_type,
|
||||||
@ -1115,6 +1117,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
|||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
error_code,
|
error_code,
|
||||||
error_message,
|
error_message,
|
||||||
|
amount_capturable,
|
||||||
} => DieselPaymentAttemptUpdate::ConfirmUpdate {
|
} => DieselPaymentAttemptUpdate::ConfirmUpdate {
|
||||||
amount,
|
amount,
|
||||||
currency,
|
currency,
|
||||||
@ -1131,6 +1134,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
|||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
error_code,
|
error_code,
|
||||||
error_message,
|
error_message,
|
||||||
|
amount_capturable,
|
||||||
},
|
},
|
||||||
Self::VoidUpdate {
|
Self::VoidUpdate {
|
||||||
status,
|
status,
|
||||||
@ -1275,10 +1279,12 @@ impl DataModelExt for PaymentAttemptUpdate {
|
|||||||
payment_token,
|
payment_token,
|
||||||
connector,
|
connector,
|
||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
|
amount_capturable,
|
||||||
} => Self::UpdateTrackers {
|
} => Self::UpdateTrackers {
|
||||||
payment_token,
|
payment_token,
|
||||||
connector,
|
connector,
|
||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
|
amount_capturable,
|
||||||
},
|
},
|
||||||
DieselPaymentAttemptUpdate::AuthenticationTypeUpdate {
|
DieselPaymentAttemptUpdate::AuthenticationTypeUpdate {
|
||||||
authentication_type,
|
authentication_type,
|
||||||
@ -1301,6 +1307,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
|||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
error_code,
|
error_code,
|
||||||
error_message,
|
error_message,
|
||||||
|
amount_capturable,
|
||||||
} => Self::ConfirmUpdate {
|
} => Self::ConfirmUpdate {
|
||||||
amount,
|
amount,
|
||||||
currency,
|
currency,
|
||||||
@ -1317,6 +1324,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
|||||||
straight_through_algorithm,
|
straight_through_algorithm,
|
||||||
error_code,
|
error_code,
|
||||||
error_message,
|
error_message,
|
||||||
|
amount_capturable,
|
||||||
},
|
},
|
||||||
DieselPaymentAttemptUpdate::VoidUpdate {
|
DieselPaymentAttemptUpdate::VoidUpdate {
|
||||||
status,
|
status,
|
||||||
|
|||||||
Reference in New Issue
Block a user