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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix: request amount fix for trustpay apple pay (#1837)
Sangamesh Kulkarni3da69f3ee160
diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rsindex a4cc41b30a..495189e898 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::<f64>()+ .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,})