From 7ca62d3c7c04997c7eed6e82ec02dc39ea046b2f Mon Sep 17 00:00:00 2001 From: SamraatBansal <55536657+SamraatBansal@users.noreply.github.com> Date: Mon, 19 Jun 2023 14:09:40 +0530 Subject: [PATCH] fix(connector): [Zen] Convert the amount to base denomination in order_details (#1477) --- .../router/src/connector/zen/transformers.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/crates/router/src/connector/zen/transformers.rs b/crates/router/src/connector/zen/transformers.rs index 958dbe35ff..d288405d38 100644 --- a/crates/router/src/connector/zen/transformers.rs +++ b/crates/router/src/connector/zen/transformers.rs @@ -395,15 +395,20 @@ fn get_item_object( _amount: String, ) -> Result, error_stack::Report> { let order_details = item.request.get_order_details()?; - Ok(order_details + + order_details .iter() - .map(|data| ZenItemObject { - name: data.product_name.clone(), - quantity: data.quantity, - price: data.amount.to_string(), - line_amount_total: (i64::from(data.quantity) * data.amount).to_string(), + .map(|data| { + Ok(ZenItemObject { + name: data.product_name.clone(), + quantity: data.quantity, + 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::>() } fn get_browser_details(