diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs index a4cc41b30aa..495189e8989 100644 --- a/crates/router/src/connector/trustpay/transformers.rs +++ b/crates/router/src/connector/trustpay/transformers.rs @@ -849,23 +849,33 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for TrustpayCreateIntentRe .as_ref() .map(|pmt| matches!(pmt, diesel_models::enums::PaymentMethodType::GooglePay)); + let request_amount = item + .request + .amount + .get_required_value("amount") + .change_context(errors::ConnectorError::MissingRequiredField { + field_name: "amount", + })?; + + let currency = item + .request + .currency + .get_required_value("currency") + .change_context(errors::ConnectorError::MissingRequiredField { + field_name: "currency", + })?; + + let amount = format!( + "{:.2}", + utils::to_currency_base_unit(request_amount, currency)? + .parse::() + .into_report() + .change_context(errors::ConnectorError::RequestEncodingFailed)? + ); + Ok(Self { - amount: item - .request - .amount - .get_required_value("amount") - .change_context(errors::ConnectorError::MissingRequiredField { - field_name: "amount", - })? - .to_string(), - currency: item - .request - .currency - .get_required_value("currency") - .change_context(errors::ConnectorError::MissingRequiredField { - field_name: "currency", - })? - .to_string(), + amount, + currency: currency.to_string(), init_apple_pay: is_apple_pay, init_google_pay: is_google_pay, })