Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

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

SamraatBansal7ca62d3c7c04
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<Vec<ZenItemObject>, error_stack::Report<errors::ConnectorError>> {
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::<Result<_, _>>()
}
fn get_browser_details(