mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
feat(connector): [Bluesnap] Add dispute webhooks support (#2053)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use std::num::TryFromIntError;
|
||||
use std::num::{ParseFloatError, TryFromIntError};
|
||||
|
||||
use router_derive;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -342,6 +342,19 @@ impl Currency {
|
||||
Ok(amount)
|
||||
}
|
||||
|
||||
///Convert the higher decimal amount to its base absolute units
|
||||
pub fn to_currency_lower_unit(&self, amount: String) -> Result<String, ParseFloatError> {
|
||||
let amount_f64 = amount.parse::<f64>()?;
|
||||
let amount_string = if self.is_zero_decimal_currency() {
|
||||
amount_f64
|
||||
} else if self.is_three_decimal_currency() {
|
||||
amount_f64 * 1000.00
|
||||
} else {
|
||||
amount_f64 * 100.00
|
||||
};
|
||||
Ok(amount_string.to_string())
|
||||
}
|
||||
|
||||
/// Convert the amount to its base denomination based on Currency and check for zero decimal currency and return String
|
||||
/// Paypal Connector accepts Zero and Two decimal currency but not three decimal and it should be updated as required for 3 decimal currencies.
|
||||
/// Paypal Ref - https://developer.paypal.com/docs/reports/reference/paypal-supported-currencies/
|
||||
|
||||
Reference in New Issue
Block a user