fix(connector): [Zen] Convert the amount to base denomination in order_details (#1477)

This commit is contained in:
SamraatBansal
2023-06-19 14:09:40 +05:30
committed by GitHub
parent 96c71e1b1b
commit 7ca62d3c7c

View File

@ -395,15 +395,20 @@ fn get_item_object(
_amount: String, _amount: String,
) -> Result<Vec<ZenItemObject>, error_stack::Report<errors::ConnectorError>> { ) -> Result<Vec<ZenItemObject>, error_stack::Report<errors::ConnectorError>> {
let order_details = item.request.get_order_details()?; let order_details = item.request.get_order_details()?;
Ok(order_details
order_details
.iter() .iter()
.map(|data| ZenItemObject { .map(|data| {
name: data.product_name.clone(), Ok(ZenItemObject {
quantity: data.quantity, name: data.product_name.clone(),
price: data.amount.to_string(), quantity: data.quantity,
line_amount_total: (i64::from(data.quantity) * data.amount).to_string(), price: utils::to_currency_base_unit(data.amount, item.request.currency)?,
line_amount_total: (f64::from(data.quantity)
* utils::to_currency_base_unit_asf64(data.amount, item.request.currency)?)
.to_string(),
})
}) })
.collect()) .collect::<Result<_, _>>()
} }
fn get_browser_details( fn get_browser_details(