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
refactor(connector): added amount conversion framework for klarna and change type of amount to MinorUnit for OrderDetailsWithAmount (#4979)
Kiran Kumar2807622ba671
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.jsonindex 9a406e9c73..8ee962b0bb 100644--- a/api-reference-v2/openapi_spec.json+++ b/api-reference-v2/openapi_spec.json@@ -10977,9 +10977,7 @@"minimum": 0},"amount": {- "type": "integer",- "format": "int64",- "description": "the amount per quantity of product"+ "$ref": "#/components/schemas/MinorUnit"},"requires_shipping": {"type": "boolean",diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.jsonindex 4b0f33da3e..2f6f4fdf0b 100644--- a/api-reference/openapi_spec.json+++ b/api-reference/openapi_spec.json@@ -14219,9 +14219,7 @@"minimum": 0},"amount": {- "type": "integer",- "format": "int64",- "description": "the amount per quantity of product"+ "$ref": "#/components/schemas/MinorUnit"},"requires_shipping": {"type": "boolean",diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex 61c7911170..4ab0158d01 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -5080,7 +5080,7 @@ pub struct OrderDetailsWithAmount {#[schema(example = 1)]pub quantity: u16,/// the amount per quantity of product- pub amount: i64,+ pub amount: MinorUnit,// Does the order includes shippingpub requires_shipping: Option<bool>,/// The image URL of the productdiff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rsindex 6a048e5314..ce2be52598 100644--- a/crates/common_utils/src/types.rs+++ b/crates/common_utils/src/types.rs@@ -7,7 +7,8 @@ pub mod authentication;use std::{borrow::Cow,fmt::Display,- ops::{Add, Sub},+ iter::Sum,+ ops::{Add, Mul, Sub},primitive::i64,str::FromStr,};@@ -483,6 +484,20 @@ impl Sub for MinorUnit {}}+impl Mul<u16> for MinorUnit {+ type Output = Self;++ fn mul(self, a2: u16) -> Self::Output {+ Self(self.0 * i64::from(a2))+ }+}++impl Sum for MinorUnit {+ fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {+ iter.fold(Self(0), |a, b| a + b)+ }+}+/// Connector specific types to send#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, PartialEq)]diff --git a/crates/hyperswitch_connectors/src/connectors/taxjar.rs b/crates/hyperswitch_connectors/src/connectors/taxjar.rsindex 56559b75ab..c2466799cd 100644--- a/crates/hyperswitch_connectors/src/connectors/taxjar.rs+++ b/crates/hyperswitch_connectors/src/connectors/taxjar.rs@@ -190,11 +190,22 @@ impl ConnectorIntegration<CalculateTax, PaymentsTaxCalculationData, TaxCalculatilet shipping = utils::convert_amount(self.amount_converter,- req.request.shipping_cost.unwrap_or(MinorUnit::new(0)),+ req.request.shipping_cost.unwrap_or(MinorUnit::zero()),req.request.currency,)?;- let connector_router_data = taxjar::TaxjarRouterData::from((amount, shipping, req));+ let order_amount = utils::convert_amount(+ self.amount_converter,+ req.request+ .order_details+ .as_ref()+ .map(|details| details.iter().map(|item| item.amount).sum())+ .unwrap_or(MinorUnit::zero()),+ req.request.currency,+ )?;++ let connector_router_data =+ taxjar::TaxjarRouterData::from((amount, order_amount, shipping, req));let connector_req = taxjar::TaxjarPaymentsRequest::try_from(&connector_router_data)?;Ok(RequestContent::Json(Box::new(connector_req)))}diff --git a/crates/hyperswitch_connectors/src/connectors/taxjar/transformers.rs b/crates/hyperswitch_connectors/src/connectors/taxjar/transformers.rsindex 1bdc2d2049..617f6d4748 100644--- a/crates/hyperswitch_connectors/src/connectors/taxjar/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/taxjar/transformers.rs@@ -7,7 +7,7 @@ use hyperswitch_domain_models::{router_response_types::TaxCalculationResponseData,types,};-use hyperswitch_interfaces::{api, errors};+use hyperswitch_interfaces::errors;use masking::Secret;use serde::{Deserialize, Serialize};@@ -18,14 +18,18 @@ use crate::{pub struct TaxjarRouterData<T> {pub amount: FloatMajorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.+ pub order_amount: FloatMajorUnit,pub shipping: FloatMajorUnit,pub router_data: T,}-impl<T> From<(FloatMajorUnit, FloatMajorUnit, T)> for TaxjarRouterData<T> {- fn from((amount, shipping, item): (FloatMajorUnit, FloatMajorUnit, T)) -> Self {+impl<T> From<(FloatMajorUnit, FloatMajorUnit, FloatMajorUnit, T)> for TaxjarRouterData<T> {+ fn from(+ (amount, order_amount, shipping, item): (FloatMajorUnit, FloatMajorUnit, FloatMajorUnit, T),+ ) -> Self {Self {amount,+ order_amount,shipping,router_data: item,}@@ -49,7 +53,7 @@ pub struct LineItem {id: Option<String>,quantity: Option<u16>,product_tax_code: Option<String>,- unit_price: Option<f64>,+ unit_price: Option<FloatMajorUnit>,}#[derive(Default, Debug, Serialize, Eq, PartialEq)]@@ -69,8 +73,6 @@ impl TryFrom<&TaxjarRouterData<&types::PaymentsTaxCalculationRouterData>>item: &TaxjarRouterData<&types::PaymentsTaxCalculationRouterData>,) -> Result<Self, Self::Error> {let request = &item.router_data.request;- let currency = item.router_data.request.currency;- let currency_unit = &api::CurrencyUnit::Base;let shipping = &item.router_data.request@@ -87,16 +89,11 @@ impl TryFrom<&TaxjarRouterData<&types::PaymentsTaxCalculationRouterData>>order_details.iter().map(|line_item| {- let unit_price = utils::get_amount_as_f64(- currency_unit,- line_item.amount,- currency,- )?;Ok(LineItem {id: line_item.product_id.clone(),quantity: Some(line_item.quantity),product_tax_code: line_item.product_tax_code.clone(),- unit_price: Some(unit_price),+ unit_price: Some(item.order_amount),})}).collect();diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rsindex d4a18a1518..166e713048 100644--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs@@ -624,11 +624,14 @@ fn get_item_object(name: data.product_name.clone(),quantity: data.quantity,price: utils::to_currency_base_unit_with_zero_decimal_check(- data.amount,+ data.amount.get_amount_as_i64(), // This should be changed to MinorUnit when we implement amount conversion for this connector. Additionally, the function get_amount_as_i64() should be avoided in the future.item.request.currency,)?,line_amount_total: (f64::from(data.quantity)- * utils::to_currency_base_unit_asf64(data.amount, item.request.currency)?)+ * utils::to_currency_base_unit_asf64(+ data.amount.get_amount_as_i64(), // This should be changed to MinorUnit when we implement amount conversion for this connector. Additionally, the function get_amount_as_i64() should be avoided in the future.+ item.request.currency,+ )?).to_string(),})})diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rsindex 21c9c34409..bc75fd29c0 100644--- a/crates/router/src/connector/adyen/transformers.rs+++ b/crates/router/src/connector/adyen/transformers.rs@@ -1770,8 +1770,8 @@ fn get_line_items(item: &AdyenRouterData<&types::PaymentsAuthorizeRouterData>) -.iter().enumerate().map(|(i, data)| LineItem {- amount_including_tax: Some(MinorUnit::new(data.amount)),- amount_excluding_tax: Some(MinorUnit::new(data.amount)),+ amount_including_tax: Some(data.amount),+ amount_excluding_tax: Some(data.amount),description: Some(data.product_name.clone()),id: Some(format!("Items #{i}")),tax_amount: None,diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rsindex 0c362d26ed..07bc6bd014 100644--- a/crates/router/src/connector/klarna.rs+++ b/crates/router/src/connector/klarna.rs@@ -1,9 +1,11 @@pub mod transformers;-use std::fmt::Debug;use api_models::enums;use base64::Engine;-use common_utils::request::RequestContent;+use common_utils::{+ request::RequestContent,+ types::{AmountConvertor, MinorUnit, MinorUnitForConnector},+};use error_stack::{report, ResultExt};use masking::PeekInterface;use router_env::logger;@@ -29,8 +31,18 @@ use crate::{utils::BytesExt,};-#[derive(Debug, Clone)]-pub struct Klarna;+#[derive(Clone)]+pub struct Klarna {+ amount_converter: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync),+}++impl Klarna {+ pub fn new() -> &'static Self {+ &Self {+ amount_converter: &MinorUnitForConnector,+ }+ }+}impl ConnectorCommon for Klarna {fn id(&self) -> &'static str {@@ -215,12 +227,12 @@ implreq: &types::PaymentsSessionRouterData,_connectors: &settings::Connectors,) -> CustomResult<RequestContent, errors::ConnectorError> {- let connector_router_data = klarna::KlarnaRouterData::try_from((- &self.get_currency_unit(),+ let amount = connector_utils::convert_amount(+ self.amount_converter,+ req.request.minor_amount,req.request.currency,- req.request.amount,- req,- ))?;+ )?;+ let connector_router_data = klarna::KlarnaRouterData::from((amount, req));let connector_req = klarna::KlarnaSessionRequest::try_from(&connector_router_data)?;// encode only for for urlencoded things.@@ -342,12 +354,12 @@ implreq: &types::PaymentsCaptureRouterData,_connectors: &settings::Connectors,) -> CustomResult<RequestContent, errors::ConnectorError> {- let connector_router_data = klarna::KlarnaRouterData::try_from((- &self.get_currency_unit(),+ let amount = connector_utils::convert_amount(+ self.amount_converter,+ req.request.minor_amount_to_capture,req.request.currency,- req.request.amount_to_capture,- req,- ))?;+ )?;+ let connector_router_data = klarna::KlarnaRouterData::from((amount, req));let connector_req = klarna::KlarnaCaptureRequest::try_from(&connector_router_data)?;Ok(RequestContent::Json(Box::new(connector_req)))}@@ -670,12 +682,12 @@ implreq: &types::PaymentsAuthorizeRouterData,_connectors: &settings::Connectors,) -> CustomResult<RequestContent, errors::ConnectorError> {- let connector_router_data = klarna::KlarnaRouterData::try_from((- &self.get_currency_unit(),+ let amount = connector_utils::convert_amount(+ self.amount_converter,+ req.request.minor_amount,req.request.currency,- req.request.amount,- req,- ))?;+ )?;+ let connector_router_data = klarna::KlarnaRouterData::from((amount, req));let connector_req = klarna::KlarnaPaymentsRequest::try_from(&connector_router_data)?;Ok(RequestContent::Json(Box::new(connector_req)))@@ -847,12 +859,12 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Refreq: &types::RefundsRouterData<api::Execute>,_connectors: &settings::Connectors,) -> CustomResult<RequestContent, errors::ConnectorError> {- let connector_router_data = klarna::KlarnaRouterData::try_from((- &self.get_currency_unit(),+ let amount = connector_utils::convert_amount(+ self.amount_converter,+ req.request.minor_refund_amount,req.request.currency,- req.request.refund_amount,- req,- ))?;+ )?;+ let connector_router_data = klarna::KlarnaRouterData::from((amount, req));let connector_req = klarna::KlarnaRefundRequest::try_from(&connector_router_data)?;Ok(RequestContent::Json(Box::new(connector_req)))}diff --git a/crates/router/src/connector/klarna/transformers.rs b/crates/router/src/connector/klarna/transformers.rsindex ea83e20d99..62a5cef0bc 100644--- a/crates/router/src/connector/klarna/transformers.rs+++ b/crates/router/src/connector/klarna/transformers.rs@@ -1,5 +1,5 @@use api_models::payments;-use common_utils::pii;+use common_utils::{pii, types::MinorUnit};use error_stack::{report, ResultExt};use hyperswitch_domain_models::router_data::KlarnaSdkResponse;use masking::{ExposeInterface, Secret};@@ -15,25 +15,16 @@ use crate::{#[derive(Debug, Serialize)]pub struct KlarnaRouterData<T> {- amount: i64,+ amount: MinorUnit,router_data: T,}-impl<T> TryFrom<(&api::CurrencyUnit, enums::Currency, i64, T)> for KlarnaRouterData<T> {- type Error = error_stack::Report<errors::ConnectorError>;-- fn try_from(- (_currency_unit, _currency, amount, router_data): (- &api::CurrencyUnit,- enums::Currency,- i64,- T,- ),- ) -> Result<Self, Self::Error> {- Ok(Self {+impl<T> From<(MinorUnit, T)> for KlarnaRouterData<T> {+ fn from((amount, router_data): (MinorUnit, T)) -> Self {+ Self {amount,router_data,- })+ }}}@@ -74,7 +65,7 @@ impl TryFrom<&Option<pii::SecretSerdeValue>> for KlarnaConnectorMetadataObject {pub struct KlarnaPaymentsRequest {auto_capture: bool,order_lines: Vec<OrderLines>,- order_amount: i64,+ order_amount: MinorUnit,purchase_country: enums::CountryAlpha2,purchase_currency: enums::Currency,merchant_reference1: Option<String>,@@ -110,7 +101,7 @@ pub struct KlarnaSessionRequest {intent: KlarnaSessionIntent,purchase_country: enums::CountryAlpha2,purchase_currency: enums::Currency,- order_amount: i64,+ order_amount: MinorUnit,order_lines: Vec<OrderLines>,shipping_address: Option<KlarnaShippingAddress>,}@@ -157,7 +148,7 @@ impl TryFrom<&KlarnaRouterData<&types::PaymentsSessionRouterData>> for KlarnaSesname: data.product_name.clone(),quantity: data.quantity,unit_price: data.amount,- total_amount: i64::from(data.quantity) * (data.amount),+ total_amount: data.amount * data.quantity,}).collect(),shipping_address: get_address_info(item.router_data.get_optional_shipping())@@ -210,7 +201,7 @@ impl TryFrom<&KlarnaRouterData<&types::PaymentsAuthorizeRouterData>> for KlarnaPname: data.product_name.clone(),quantity: data.quantity,unit_price: data.amount,- total_amount: i64::from(data.quantity) * (data.amount),+ total_amount: data.amount * data.quantity,}).collect(),merchant_reference1: Some(item.router_data.connector_request_reference_id.clone()),@@ -294,8 +285,8 @@ impl TryFrom<types::PaymentsResponseRouterData<KlarnaPaymentsResponse>>pub struct OrderLines {name: String,quantity: u16,- unit_price: i64,- total_amount: i64,+ unit_price: MinorUnit,+ total_amount: MinorUnit,}#[derive(Debug, Serialize)]@@ -412,7 +403,7 @@ impl<F, T>#[derive(Debug, Serialize)]pub struct KlarnaCaptureRequest {- captured_amount: i64,+ captured_amount: MinorUnit,reference: Option<String>,}@@ -490,7 +481,7 @@ impl<F>#[derive(Default, Debug, Serialize)]pub struct KlarnaRefundRequest {- refunded_amount: i64,+ refunded_amount: MinorUnit,reference: Option<String>,}diff --git a/crates/router/src/connector/riskified/transformers/api.rs b/crates/router/src/connector/riskified/transformers/api.rsindex 2e0ac3b004..d2d38855da 100644--- a/crates/router/src/connector/riskified/transformers/api.rs+++ b/crates/router/src/connector/riskified/transformers/api.rs@@ -163,7 +163,7 @@ impl TryFrom<&frm_types::FrmCheckoutRouterData> for RiskifiedPaymentsCheckoutReq.get_order_details()?.iter().map(|order_detail| LineItem {- price: order_detail.amount,+ price: order_detail.amount.get_amount_as_i64(), // This should be changed to MinorUnit when we implement amount conversion for this connector. Additionally, the function get_amount_as_i64() should be avoided in the future.quantity: i32::from(order_detail.quantity),title: order_detail.product_name.clone(),product_type: order_detail.product_type.clone(),diff --git a/crates/router/src/connector/signifyd/transformers/api.rs b/crates/router/src/connector/signifyd/transformers/api.rsindex 6aeda8f8d4..eed0e9937b 100644--- a/crates/router/src/connector/signifyd/transformers/api.rs+++ b/crates/router/src/connector/signifyd/transformers/api.rs@@ -145,7 +145,7 @@ impl TryFrom<&frm_types::FrmSaleRouterData> for SignifydPaymentsSaleRequest {.iter().map(|order_detail| Products {item_name: order_detail.product_name.clone(),- item_price: order_detail.amount,+ item_price: order_detail.amount.get_amount_as_i64(), // This should be changed to MinorUnit when we implement amount conversion for this connector. Additionally, the function get_amount_as_i64() should be avoided in the future.item_quantity: i32::from(order_detail.quantity),item_id: order_detail.product_id.clone(),item_category: order_detail.category.clone(),@@ -382,7 +382,7 @@ impl TryFrom<&frm_types::FrmCheckoutRouterData> for SignifydPaymentsCheckoutRequ.iter().map(|order_detail| Products {item_name: order_detail.product_name.clone(),- item_price: order_detail.amount,+ item_price: order_detail.amount.get_amount_as_i64(), // This should be changed to MinorUnit when we implement amount conversion for this connector. Additionally, the function get_amount_as_i64() should be avoided in the future.item_quantity: i32::from(order_detail.quantity),item_id: order_detail.product_id.clone(),item_category: order_detail.category.clone(),diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rsindex ebc522b30a..09a2457197 100644--- a/crates/router/src/core/payment_link.rs+++ b/crates/router/src/core/payment_link.rs@@ -11,7 +11,7 @@ use common_utils::{DEFAULT_PRODUCT_IMG, DEFAULT_SDK_LAYOUT, DEFAULT_SESSION_EXPIRY,},ext_traits::{AsyncExt, OptionExt, ValueExt},- types::{AmountConvertor, MinorUnit, StringMajorUnitForCore},+ types::{AmountConvertor, StringMajorUnitForCore},};use error_stack::{report, ResultExt};use futures::future;@@ -547,7 +547,7 @@ fn validate_order_details(.clone_from(&order.product_img_link)};order_details_amount_string.amount = required_conversion_type- .convert(MinorUnit::new(order.amount), currency)+ .convert(order.amount, currency).change_context(errors::ApiErrorResponse::AmountConversionFailed {amount_type: "StringMajorUnit",})?;diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex 0de7683097..1f67e8066c 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -5445,13 +5445,13 @@ pub async fn get_unified_translation(}pub fn validate_order_details_amount(order_details: Vec<api_models::payments::OrderDetailsWithAmount>,- amount: i64,+ amount: MinorUnit,should_validate: bool,) -> Result<(), errors::ApiErrorResponse> {if should_validate {- let total_order_details_amount: i64 = order_details+ let total_order_details_amount: MinorUnit = order_details.iter()- .map(|order| order.amount * i64::from(order.quantity))+ .map(|order| order.amount * order.quantity).sum();if total_order_details_amount != amount {diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rsindex 69cf19b09b..3a66094081 100644--- a/crates/router/src/core/payments/operations/payment_confirm.rs+++ b/crates/router/src/core/payments/operations/payment_confirm.rs@@ -98,7 +98,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Paif let Some(order_details) = &request.order_details {helpers::validate_order_details_amount(order_details.to_owned(),- payment_intent.amount.get_amount_as_i64(),+ payment_intent.amount,false,)?;}diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rsindex 3bccce2783..696bd1468e 100644--- a/crates/router/src/core/payments/operations/payment_create.rs+++ b/crates/router/src/core/payments/operations/payment_create.rs@@ -338,7 +338,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Paif let Some(order_details) = &request.order_details {helpers::validate_order_details_amount(order_details.to_owned(),- payment_intent.amount.get_amount_as_i64(),+ payment_intent.amount,false,)?;}diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rsindex 757370f0c9..0b530d4d05 100644--- a/crates/router/src/core/payments/operations/payment_update.rs+++ b/crates/router/src/core/payments/operations/payment_update.rs@@ -82,7 +82,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Paif let Some(order_details) = &request.order_details {helpers::validate_order_details_amount(order_details.to_owned(),- payment_intent.amount.get_amount_as_i64(),+ payment_intent.amount,false,)?;}diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex 0ba8905303..fe217445ee 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -1974,7 +1974,7 @@ pub fn voucher_next_steps_check(}pub fn change_order_details_to_new_type(- order_amount: i64,+ order_amount: MinorUnit,order_details: api_models::payments::OrderDetails,) -> Option<Vec<api_models::payments::OrderDetailsWithAmount>> {Some(vec![api_models::payments::OrderDetailsWithAmount {diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rsindex 198d400b85..b85ae5bfab 100644--- a/crates/router/src/types/api.rs+++ b/crates/router/src/types/api.rs@@ -430,7 +430,9 @@ impl ConnectorData {enums::Connector::Itaubank => {Ok(ConnectorEnum::Old(Box::new(connector::Itaubank::new())))}- enums::Connector::Klarna => Ok(ConnectorEnum::Old(Box::new(&connector::Klarna))),+ enums::Connector::Klarna => {+ Ok(ConnectorEnum::Old(Box::new(connector::Klarna::new())))+ }enums::Connector::Mollie => {Ok(ConnectorEnum::Old(Box::new(connector::Mollie::new())))}diff --git a/crates/router/tests/connectors/payme.rs b/crates/router/tests/connectors/payme.rsindex e85c57df62..3b4cf5195f 100644--- a/crates/router/tests/connectors/payme.rs+++ b/crates/router/tests/connectors/payme.rs@@ -1,7 +1,7 @@use std::str::FromStr;use api_models::payments::{Address, AddressDetails, OrderDetailsWithAmount};-use common_utils::pii::Email;+use common_utils::{pii::Email, types::MinorUnit};use masking::Secret;use router::types::{self, domain, storage::enums, PaymentAddress};@@ -80,7 +80,7 @@ fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {order_details: Some(vec![OrderDetailsWithAmount {product_name: "iphone 13".to_string(),quantity: 1,- amount: 1000,+ amount: MinorUnit::new(1000),product_img_link: None,requires_shipping: None,product_id: None,@@ -381,7 +381,7 @@ async fn should_fail_payment_for_incorrect_cvc() {order_details: Some(vec![OrderDetailsWithAmount {product_name: "iphone 13".to_string(),quantity: 1,- amount: 100,+ amount: MinorUnit::new(100),product_img_link: None,requires_shipping: None,product_id: None,@@ -421,7 +421,7 @@ async fn should_fail_payment_for_invalid_exp_month() {order_details: Some(vec![OrderDetailsWithAmount {product_name: "iphone 13".to_string(),quantity: 1,- amount: 100,+ amount: MinorUnit::new(100),product_img_link: None,requires_shipping: None,product_id: None,@@ -461,7 +461,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() {order_details: Some(vec![OrderDetailsWithAmount {product_name: "iphone 13".to_string(),quantity: 1,- amount: 100,+ amount: MinorUnit::new(100),product_img_link: None,requires_shipping: None,product_id: None,diff --git a/crates/router/tests/connectors/zen.rs b/crates/router/tests/connectors/zen.rsindex 20948a90c6..da83bdc7d4 100644--- a/crates/router/tests/connectors/zen.rs+++ b/crates/router/tests/connectors/zen.rs@@ -325,7 +325,7 @@ async fn should_fail_payment_for_incorrect_card_number() {order_details: Some(vec![OrderDetailsWithAmount {product_name: "test".to_string(),quantity: 1,- amount: 1000,+ amount: MinorUnit::new(1000),product_img_link: None,requires_shipping: None,product_id: None,@@ -368,7 +368,7 @@ async fn should_fail_payment_for_incorrect_cvc() {order_details: Some(vec![OrderDetailsWithAmount {product_name: "test".to_string(),quantity: 1,- amount: 1000,+ amount: MinorUnit::new(1000),product_img_link: None,requires_shipping: None,product_id: None,@@ -411,7 +411,7 @@ async fn should_fail_payment_for_invalid_exp_month() {order_details: Some(vec![OrderDetailsWithAmount {product_name: "test".to_string(),quantity: 1,- amount: 1000,+ amount: MinorUnit::new(1000),product_img_link: None,requires_shipping: None,product_id: None,@@ -454,7 +454,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() {order_details: Some(vec![OrderDetailsWithAmount {product_name: "test".to_string(),quantity: 1,- amount: 1000,+ amount: MinorUnit::new(1000),product_img_link: None,requires_shipping: None,product_id: None,