feat(core): enable surcharge support for all connectors (#3109)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Hrithikesh
2023-12-14 11:38:14 +05:30
committed by GitHub
parent 4d19d8b1d1
commit 57e1ae9dea
25 changed files with 131 additions and 72 deletions

View File

@ -156,6 +156,16 @@ pub struct PaymentAttempt {
pub unified_message: Option<String>,
}
impl PaymentAttempt {
pub fn get_total_amount(&self) -> i64 {
self.amount + self.surcharge_amount.unwrap_or(0) + self.tax_amount.unwrap_or(0)
}
pub fn get_total_surcharge_amount(&self) -> Option<i64> {
self.surcharge_amount
.map(|surcharge_amount| surcharge_amount + self.tax_amount.unwrap_or(0))
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PaymentListFilters {
pub connector: Vec<String>,