Skip to content

Commit

Permalink
fix(router): fixed compilation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hex1c committed Nov 10, 2024
1 parent c60238e commit 920454c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 27 deletions.
19 changes: 10 additions & 9 deletions crates/hyperswitch_connectors/src/connectors/nexinets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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,
},
};

Expand Down Expand Up @@ -257,7 +258,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
req: &PaymentsAuthorizeRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount = connector_utils::convert_amount(
let amount = convert_amount(
self.amount_converter,
req.request.minor_amount,
req.request.currency,
Expand Down Expand Up @@ -427,7 +428,7 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
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,
Expand Down Expand Up @@ -520,7 +521,7 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Ne
req: &PaymentsCancelRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount_to_cancel = connector_utils::convert_amount(
let amount_to_cancel = convert_amount(
self.amount_converter,
req.request
.minor_amount
Expand Down Expand Up @@ -613,7 +614,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Nexinet
req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let refund_amount = connector_utils::convert_amount(
let refund_amount = convert_amount(
self.amount_converter,
req.request.minor_refund_amount,
req.request.currency,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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<errors::ConnectorError>;
fn try_from(
item: &NexinetsRouterData<&types::PaymentsAuthorizeRouterData>,
item: &NexinetsRouterData<&PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
let request = &item.router_data.request;
let return_url = request.router_return_url.clone();
Expand Down Expand Up @@ -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<errors::ConnectorError>;
fn try_from(
item: &NexinetsRouterData<&types::PaymentsCaptureRouterData>,
item: &NexinetsRouterData<&PaymentsCaptureRouterData>,
) -> Result<Self, Self::Error> {
Ok(Self {
initial_amount: item.amount.to_owned(),
Expand All @@ -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<errors::ConnectorError>;
fn try_from(
item: &NexinetsRouterData<&types::PaymentsCancelRouterData>,
) -> Result<Self, Self::Error> {
fn try_from(item: &NexinetsRouterData<&PaymentsCancelRouterData>) -> Result<Self, Self::Error> {
Ok(Self {
initial_amount: item.amount.to_owned(),
currency: item.router_data.request.get_currency()?,
Expand Down Expand Up @@ -500,11 +492,9 @@ pub struct NexinetsRefundRequest {
pub currency: enums::Currency,
}

impl<F> TryFrom<&NexinetsRouterData<&types::RefundsRouterData<F>>> for NexinetsRefundRequest {
impl<F> TryFrom<&NexinetsRouterData<&RefundsRouterData<F>>> for NexinetsRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &NexinetsRouterData<&types::RefundsRouterData<F>>,
) -> Result<Self, Self::Error> {
fn try_from(item: &NexinetsRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
Ok(Self {
initial_amount: item.amount.to_owned(),
currency: item.router_data.request.currency,
Expand Down

0 comments on commit 920454c

Please sign in to comment.