From 920454c6e95b87011114adbcabade1c980e8ba1d Mon Sep 17 00:00:00 2001 From: hex1c Date: Sun, 10 Nov 2024 10:59:14 +0530 Subject: [PATCH] fix(router): fixed compilation issues --- .../src/connectors/nexinets.rs | 19 +++++++------- .../src/connectors/nexinets/transformers.rs | 26 ++++++------------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets.rs b/crates/hyperswitch_connectors/src/connectors/nexinets.rs index 66d46642ecf7..8a2d86c576f2 100644 --- a/crates/hyperswitch_connectors/src/connectors/nexinets.rs +++ b/crates/hyperswitch_connectors/src/connectors/nexinets.rs @@ -4,11 +4,11 @@ use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId}; use common_enums::enums; use common_utils::{ errors::CustomResult, - ext_traits::ByteSliceExt, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, + ext_traits::ByteSliceExt, request::{Method, Request, RequestBuilder, RequestContent}, + types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use error_stack::{report, ResultExt}; -use nexinets::NexinetsRouterData; use hyperswitch_domain_models::{ payment_method_data::PaymentMethodData, router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, @@ -40,15 +40,16 @@ use hyperswitch_interfaces::{ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails}, }; use masking::Mask; +use nexinets::NexinetsRouterData; use transformers as nexinets; -use super::utils::PaymentsCancelRequestData; use crate::{ constants::headers, types::ResponseRouterData, utils::{ - construct_not_implemented_error_report, is_mandate_supported, to_connector_meta, - PaymentMethodDataType, PaymentsSyncRequestData, + construct_not_implemented_error_report, convert_amount, is_mandate_supported, + to_connector_meta, PaymentMethodDataType, PaymentsCancelRequestData, + PaymentsSyncRequestData, }, }; @@ -257,7 +258,7 @@ impl ConnectorIntegration CustomResult { - let amount = connector_utils::convert_amount( + let amount = convert_amount( self.amount_converter, req.request.minor_amount, req.request.currency, @@ -427,7 +428,7 @@ impl ConnectorIntegration fo req: &PaymentsCaptureRouterData, _connectors: &Connectors, ) -> CustomResult { - let amount_to_capture = connector_utils::convert_amount( + let amount_to_capture = convert_amount( self.amount_converter, req.request.minor_amount_to_capture, req.request.currency, @@ -520,7 +521,7 @@ impl ConnectorIntegration for Ne req: &PaymentsCancelRouterData, _connectors: &Connectors, ) -> CustomResult { - let amount_to_cancel = connector_utils::convert_amount( + let amount_to_cancel = convert_amount( self.amount_converter, req.request .minor_amount @@ -613,7 +614,7 @@ impl ConnectorIntegration for Nexinet req: &RefundsRouterData, _connectors: &Connectors, ) -> CustomResult { - let refund_amount = connector_utils::convert_amount( + let refund_amount = convert_amount( self.amount_converter, req.request.minor_refund_amount, req.request.currency, diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs index 0b3b34241fe0..6a125d7502ec 100644 --- a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs @@ -2,8 +2,6 @@ use base64::Engine; use cards::CardNumber; use common_enums::{enums, AttemptStatus}; use common_utils::{consts, errors::CustomResult, request::Method, types::MinorUnit}; -use common_utils::{types::MinorUnit}; -use domain::PaymentMethodData; use error_stack::ResultExt; use hyperswitch_domain_models::{ payment_method_data::{ @@ -194,10 +192,10 @@ pub struct ApplepayPaymentMethod { token_type: String, } -impl TryFrom<&NexinetsRouterData<&types::PaymentsAuthorizeRouterData>> for NexinetsPaymentsRequest { +impl TryFrom<&NexinetsRouterData<&PaymentsAuthorizeRouterData>> for NexinetsPaymentsRequest { type Error = error_stack::Report; fn try_from( - item: &NexinetsRouterData<&types::PaymentsAuthorizeRouterData>, + item: &NexinetsRouterData<&PaymentsAuthorizeRouterData>, ) -> Result { let request = &item.router_data.request; let return_url = request.router_return_url.clone(); @@ -416,12 +414,10 @@ pub struct NexinetsOrder { pub order_id: String, } -impl TryFrom<&NexinetsRouterData<&types::PaymentsCaptureRouterData>> - for NexinetsCaptureOrVoidRequest -{ +impl TryFrom<&NexinetsRouterData<&PaymentsCaptureRouterData>> for NexinetsCaptureOrVoidRequest { type Error = error_stack::Report; fn try_from( - item: &NexinetsRouterData<&types::PaymentsCaptureRouterData>, + item: &NexinetsRouterData<&PaymentsCaptureRouterData>, ) -> Result { Ok(Self { initial_amount: item.amount.to_owned(), @@ -430,13 +426,9 @@ impl TryFrom<&NexinetsRouterData<&types::PaymentsCaptureRouterData>> } } -impl TryFrom<&NexinetsRouterData<&types::PaymentsCancelRouterData>> - for NexinetsCaptureOrVoidRequest -{ +impl TryFrom<&NexinetsRouterData<&PaymentsCancelRouterData>> for NexinetsCaptureOrVoidRequest { type Error = error_stack::Report; - fn try_from( - item: &NexinetsRouterData<&types::PaymentsCancelRouterData>, - ) -> Result { + fn try_from(item: &NexinetsRouterData<&PaymentsCancelRouterData>) -> Result { Ok(Self { initial_amount: item.amount.to_owned(), currency: item.router_data.request.get_currency()?, @@ -500,11 +492,9 @@ pub struct NexinetsRefundRequest { pub currency: enums::Currency, } -impl TryFrom<&NexinetsRouterData<&types::RefundsRouterData>> for NexinetsRefundRequest { +impl TryFrom<&NexinetsRouterData<&RefundsRouterData>> for NexinetsRefundRequest { type Error = error_stack::Report; - fn try_from( - item: &NexinetsRouterData<&types::RefundsRouterData>, - ) -> Result { + fn try_from(item: &NexinetsRouterData<&RefundsRouterData>) -> Result { Ok(Self { initial_amount: item.amount.to_owned(), currency: item.router_data.request.currency,