diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json index 592e5c7deaeb..d464e8cb194b 100644 --- a/api-reference/openapi_spec.json +++ b/api-reference/openapi_spec.json @@ -5001,7 +5001,8 @@ }, "amount": { "type": "string", - "description": "The total amount for the payment" + "description": "The total amount for the payment in majot unit string (Ex: 38.02)", + "example": "38.02" } } }, @@ -10039,7 +10040,8 @@ }, "total_price": { "type": "string", - "description": "The total price" + "description": "The total price", + "example": "38.02" } } }, diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 498a0566e3c5..f93467634c5b 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -11,7 +11,7 @@ use common_utils::{ ext_traits::{ConfigExt, Encode}, id_type, pii::{self, Email}, - types::MinorUnit, + types::{MinorUnit, StringMajorUnit}, }; use masking::{PeekInterface, Secret}; use router_derive::Setter; @@ -4174,7 +4174,8 @@ pub struct GpayTransactionInfo { /// The total price status (ex: 'FINAL') pub total_price_status: String, /// The total price - pub total_price: String, + #[schema(value_type = String, example = "38.02")] + pub total_price: StringMajorUnit, } #[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)] @@ -4546,8 +4547,9 @@ pub struct AmountInfo { /// A value that indicates whether the line item(Ex: total, tax, discount, or grand total) is final or pending. #[serde(rename = "type")] pub total_type: Option, - /// The total amount for the payment - pub amount: String, + /// The total amount for the payment in majot unit string (Ex: 38.02) + #[schema(value_type = String, example = "38.02")] + pub amount: StringMajorUnit, } #[derive(Debug, Clone, serde::Deserialize)] diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs index f91bd9d890a5..bcf84e560e33 100644 --- a/crates/hyperswitch_domain_models/src/router_request_types.rs +++ b/crates/hyperswitch_domain_models/src/router_request_types.rs @@ -685,6 +685,9 @@ pub struct PaymentsSessionData { pub country: Option, pub surcharge_details: Option, pub order_details: Option>, + + // Minor Unit amount for amount frame work + pub minor_amount: MinorUnit, } #[derive(Debug, Clone)] diff --git a/crates/router/src/connector/bluesnap.rs b/crates/router/src/connector/bluesnap.rs index b7da3d0da18a..7fb4869dc834 100644 --- a/crates/router/src/connector/bluesnap.rs +++ b/crates/router/src/connector/bluesnap.rs @@ -33,6 +33,7 @@ use crate::{ types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, + transformers::ForeignTryFrom, ErrorResponse, Response, }, utils::BytesExt, @@ -603,11 +604,20 @@ impl ConnectorIntegration for BluesnapCreateWalletToken { } } -impl TryFrom> - for types::PaymentsSessionRouterData +impl + ForeignTryFrom<( + types::PaymentsSessionResponseRouterData, + StringMajorUnit, + )> for types::PaymentsSessionRouterData { type Error = error_stack::Report; - fn try_from( - item: types::PaymentsSessionResponseRouterData, + fn foreign_try_from( + (item, apple_pay_amount): ( + types::PaymentsSessionResponseRouterData, + StringMajorUnit, + ), ) -> Result { let response = &item.response; @@ -532,7 +538,7 @@ impl TryFrom + Sync), + apple_pay_google_pay_amount_converter: + &'static (dyn AmountConvertor + Sync), +} +impl Payme { + pub const fn new() -> &'static Self { + &Self { + amount_converter: &MinorUnitForConnector, + apple_pay_google_pay_amount_converter: &StringMajorUnitForConnector, + } + } +} +// dummy commit impl api::Payment for Payme {} impl api::PaymentSession for Payme {} impl api::PaymentsCompleteAuthorize for Payme {} @@ -287,10 +308,11 @@ impl req: &types::PaymentsPreProcessingRouterData, _connectors: &settings::Connectors, ) -> CustomResult { - let amount = req.request.get_amount()?; - let currency = req.request.get_currency()?; - let connector_router_data = - payme::PaymeRouterData::try_from((&self.get_currency_unit(), currency, amount, req))?; + let req_amount = req.request.get_minor_amount()?; + let req_currency = req.request.get_currency()?; + let amount = + connector_utils::convert_amount(self.amount_converter, req_amount, req_currency)?; + let connector_router_data = payme::PaymeRouterData::try_from((amount, req))?; let connector_req = payme::GenerateSaleRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } @@ -329,14 +351,26 @@ impl .parse_struct("Payme GenerateSaleResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + let req_amount = data.request.get_minor_amount()?; + let req_currency = data.request.get_currency()?; + + let apple_pay_amount = connector_utils::convert_amount( + self.apple_pay_google_pay_amount_converter, + req_amount, + req_currency, + )?; + event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) + types::RouterData::foreign_try_from(( + types::ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }, + apple_pay_amount, + )) } fn get_error_response( @@ -536,12 +570,12 @@ impl ConnectorIntegration CustomResult { - let connector_router_data = payme::PaymeRouterData::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 = payme::PaymeRouterData::try_from((amount, req))?; let connector_req = payme::PaymePaymentRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } @@ -724,12 +758,12 @@ impl ConnectorIntegration CustomResult { - let connector_router_data = payme::PaymeRouterData::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 = payme::PaymeRouterData::try_from((amount, req))?; let connector_req = payme::PaymentCaptureRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } @@ -822,20 +856,21 @@ impl ConnectorIntegration CustomResult { - let amount = req - .request - .amount - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "amount", - })?; - let currency = + let req_amount = + req.request + .minor_amount + .ok_or(errors::ConnectorError::MissingRequiredField { + field_name: "amount", + })?; + let req_currency = req.request .currency .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "currency", })?; - let connector_router_data = - payme::PaymeRouterData::try_from((&self.get_currency_unit(), currency, amount, req))?; + let amount = + connector_utils::convert_amount(self.amount_converter, req_amount, req_currency)?; + let connector_router_data = payme::PaymeRouterData::try_from((amount, req))?; let connector_req = payme::PaymeVoidRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } @@ -922,12 +957,12 @@ impl ConnectorIntegration, _connectors: &settings::Connectors, ) -> CustomResult { - let connector_router_data = payme::PaymeRouterData::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 = payme::PaymeRouterData::try_from((amount, req))?; let connector_req = payme::PaymeRefundRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs index 7c6f426d38b3..5cb025816d68 100644 --- a/crates/router/src/connector/payme/transformers.rs +++ b/crates/router/src/connector/payme/transformers.rs @@ -1,7 +1,10 @@ use std::collections::HashMap; use api_models::enums::{AuthenticationType, PaymentMethod}; -use common_utils::pii; +use common_utils::{ + pii, + types::{MinorUnit, StringMajorUnit}, +}; use error_stack::ResultExt; use masking::{ExposeInterface, Secret}; use serde::{Deserialize, Serialize}; @@ -18,7 +21,10 @@ use crate::{ core::errors, services, types::{ - self, api, domain, domain::PaymentMethodData, storage::enums, transformers::ForeignFrom, + self, api, domain, + domain::PaymentMethodData, + storage::enums, + transformers::{ForeignFrom, ForeignTryFrom}, MandateReference, }, unimplemented_payment_method, @@ -28,15 +34,13 @@ const LANGUAGE: &str = "en"; #[derive(Debug, Serialize)] pub struct PaymeRouterData { - pub amount: i64, + pub amount: MinorUnit, pub router_data: T, } -impl TryFrom<(&api::CurrencyUnit, enums::Currency, i64, T)> for PaymeRouterData { +impl TryFrom<(MinorUnit, T)> for PaymeRouterData { type Error = error_stack::Report; - fn try_from( - (_currency_unit, _currency, amount, item): (&api::CurrencyUnit, enums::Currency, i64, T), - ) -> Result { + fn try_from((amount, item): (MinorUnit, T)) -> Result { Ok(Self { amount, router_data: item, @@ -57,7 +61,7 @@ pub struct PayRequest { #[derive(Debug, Serialize)] pub struct MandateRequest { currency: enums::Currency, - sale_price: i64, + sale_price: MinorUnit, transaction_id: String, product_name: String, sale_return_url: String, @@ -118,7 +122,7 @@ pub struct CaptureBuyerResponse { pub struct GenerateSaleRequest { currency: enums::Currency, sale_type: SaleType, - sale_price: i64, + sale_price: MinorUnit, transaction_id: String, product_name: String, sale_return_url: String, @@ -473,23 +477,27 @@ impl TryFrom<&types::RefundSyncRouterData> for PaymeQueryTransactionRequest { } impl - TryFrom< + ForeignTryFrom<( types::ResponseRouterData< F, GenerateSaleResponse, types::PaymentsPreProcessingData, types::PaymentsResponseData, >, - > for types::RouterData + StringMajorUnit, + )> for types::RouterData { type Error = error_stack::Report; - fn try_from( - item: types::ResponseRouterData< - F, - GenerateSaleResponse, - types::PaymentsPreProcessingData, - types::PaymentsResponseData, - >, + fn foreign_try_from( + (item, apple_pay_amount): ( + types::ResponseRouterData< + F, + GenerateSaleResponse, + types::PaymentsPreProcessingData, + types::PaymentsResponseData, + >, + StringMajorUnit, + ), ) -> Result { match item.data.payment_method { PaymentMethod::Card => { @@ -537,8 +545,6 @@ impl } _ => { let currency_code = item.data.request.get_currency()?; - let amount = item.data.request.get_amount()?; - let amount_in_base_unit = utils::to_currency_base_unit(amount, currency_code)?; let pmd = item.data.request.payment_method_data.to_owned(); let payme_auth_type = PaymeAuthType::try_from(&item.data.connector_auth_type)?; @@ -556,7 +562,7 @@ impl total: api_models::payments::AmountInfo { label: "Apple Pay".to_string(), total_type: None, - amount: amount_in_base_unit, + amount: apple_pay_amount, }, merchant_capabilities: None, supported_networks: None, @@ -907,7 +913,7 @@ impl #[derive(Debug, Serialize)] pub struct PaymentCaptureRequest { payme_sale_id: String, - sale_price: i64, + sale_price: MinorUnit, } impl TryFrom<&PaymeRouterData<&types::PaymentsCaptureRouterData>> for PaymentCaptureRequest { @@ -915,7 +921,9 @@ impl TryFrom<&PaymeRouterData<&types::PaymentsCaptureRouterData>> for PaymentCap fn try_from( item: &PaymeRouterData<&types::PaymentsCaptureRouterData>, ) -> Result { - if item.router_data.request.amount_to_capture != item.router_data.request.payment_amount { + if item.router_data.request.minor_amount_to_capture + != item.router_data.request.minor_payment_amount + { Err(errors::ConnectorError::NotSupported { message: "Partial Capture".to_string(), connector: "Payme", @@ -932,7 +940,7 @@ impl TryFrom<&PaymeRouterData<&types::PaymentsCaptureRouterData>> for PaymentCap // Type definition for RefundRequest #[derive(Debug, Serialize)] pub struct PaymeRefundRequest { - sale_refund_amount: i64, + sale_refund_amount: MinorUnit, payme_sale_id: String, seller_payme_id: Secret, language: String, diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rs index e2904221e59c..6ec8b37982ac 100644 --- a/crates/router/src/connector/trustpay.rs +++ b/crates/router/src/connector/trustpay.rs @@ -1,18 +1,21 @@ pub mod transformers; -use std::fmt::Debug; - use base64::Engine; use common_utils::{ - crypto, errors::ReportSwitchExt, ext_traits::ByteSliceExt, request::RequestContent, + crypto, + errors::ReportSwitchExt, + ext_traits::ByteSliceExt, + request::RequestContent, + types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector}, }; use error_stack::{Report, ResultExt}; use masking::PeekInterface; use transformers as trustpay; use super::utils::{ - collect_and_sort_values_by_removing_signature, get_error_code_error_message_based_on_priority, - ConnectorErrorType, ConnectorErrorTypeMapping, PaymentsPreProcessingData, + self as connector_utils, collect_and_sort_values_by_removing_signature, + get_error_code_error_message_based_on_priority, ConnectorErrorType, ConnectorErrorTypeMapping, + PaymentsPreProcessingData, }; use crate::{ configs::settings, @@ -36,8 +39,18 @@ use crate::{ utils::{self, BytesExt}, }; -#[derive(Debug, Clone)] -pub struct Trustpay; +#[derive(Clone)] +pub struct Trustpay { + amount_converter: &'static (dyn AmountConvertor + Sync), +} + +impl Trustpay { + pub fn new() -> &'static Self { + &Self { + amount_converter: &StringMajorUnitForConnector, + } + } +} impl ConnectorCommonExt for Trustpay where @@ -462,14 +475,13 @@ impl req: &types::PaymentsPreProcessingRouterData, _connectors: &settings::Connectors, ) -> CustomResult { - let currency = req.request.get_currency()?; - let amount = req.request.get_amount()?; - let connector_router_data = trustpay::TrustpayRouterData::try_from(( - &self.get_currency_unit(), - currency, - amount, - req, - ))?; + let req_currency = req.request.get_currency()?; + let req_amount = req.request.get_minor_amount()?; + + let amount = + connector_utils::convert_amount(self.amount_converter, req_amount, req_currency)?; + + let connector_router_data = trustpay::TrustpayRouterData::try_from((amount, req))?; let connector_req = trustpay::TrustpayCreateIntentRequest::try_from(&connector_router_data)?; Ok(RequestContent::FormUrlEncoded(Box::new(connector_req))) @@ -576,13 +588,12 @@ impl ConnectorIntegration CustomResult { - let amount = req.request.amount; - let connector_router_data = trustpay::TrustpayRouterData::try_from(( - &self.get_currency_unit(), + let amount = connector_utils::convert_amount( + self.amount_converter, + req.request.minor_amount, req.request.currency, - amount, - req, - ))?; + )?; + let connector_router_data = trustpay::TrustpayRouterData::try_from((amount, req))?; let connector_req = trustpay::TrustpayPaymentsRequest::try_from(&connector_router_data)?; match req.payment_method { diesel_models::enums::PaymentMethod::BankRedirect => { @@ -686,12 +697,13 @@ impl ConnectorIntegration, _connectors: &settings::Connectors, ) -> CustomResult { - let connector_router_data = trustpay::TrustpayRouterData::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 = trustpay::TrustpayRouterData::try_from((amount, req))?; let connector_req = trustpay::TrustpayRefundRequest::try_from(&connector_router_data)?; match req.payment_method { diesel_models::enums::PaymentMethod::BankRedirect => { diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs index b07b819f37d7..b48c52c76ff8 100644 --- a/crates/router/src/connector/trustpay/transformers.rs +++ b/crates/router/src/connector/trustpay/transformers.rs @@ -3,6 +3,7 @@ use std::collections::HashMap; use common_utils::{ errors::CustomResult, pii::{self, Email}, + types::StringMajorUnit, }; use error_stack::{report, ResultExt}; use masking::{ExposeInterface, PeekInterface, Secret}; @@ -24,21 +25,13 @@ type Error = error_stack::Report; #[derive(Debug, Serialize)] pub struct TrustpayRouterData { - pub amount: String, + pub amount: StringMajorUnit, pub router_data: T, } -impl TryFrom<(&types::api::CurrencyUnit, enums::Currency, i64, T)> for TrustpayRouterData { +impl TryFrom<(StringMajorUnit, T)> for TrustpayRouterData { type Error = error_stack::Report; - fn try_from( - (currency_unit, currency, amount, item): ( - &types::api::CurrencyUnit, - enums::Currency, - i64, - T, - ), - ) -> Result { - let amount = utils::get_amount_as_string(currency_unit, amount, currency)?; + fn try_from((amount, item): (StringMajorUnit, T)) -> Result { Ok(Self { amount, router_data: item, @@ -97,7 +90,7 @@ pub struct References { #[derive(Default, Debug, Serialize, Deserialize, Eq, PartialEq, Clone)] #[serde(rename_all = "PascalCase")] pub struct Amount { - pub amount: String, + pub amount: StringMajorUnit, pub currency: String, } @@ -147,7 +140,7 @@ pub struct CallbackURLs { #[derive(Debug, Serialize, PartialEq)] pub struct PaymentRequestCards { - pub amount: String, + pub amount: StringMajorUnit, pub currency: String, pub pan: cards::CardNumber, pub cvv: Secret, @@ -273,7 +266,7 @@ fn get_card_request_data( item: &types::PaymentsAuthorizeRouterData, browser_info: &BrowserInformation, params: TrustpayMandatoryParams, - amount: String, + amount: StringMajorUnit, ccard: &domain::payments::Card, return_url: String, ) -> Result { @@ -353,7 +346,7 @@ fn get_bank_redirection_request_data( item: &types::PaymentsAuthorizeRouterData, bank_redirection_data: &domain::BankRedirectData, params: TrustpayMandatoryParams, - amount: String, + amount: StringMajorUnit, auth: TrustpayAuthType, ) -> Result> { let pm = TrustpayPaymentMethod::try_from(bank_redirection_data)?; @@ -1016,7 +1009,7 @@ impl TryFrom, @@ -1084,7 +1077,7 @@ pub struct GooglePayTransactionInfo { pub country_code: api_models::enums::CountryAlpha2, pub currency_code: api_models::enums::Currency, pub total_price_status: String, - pub total_price: String, + pub total_price: StringMajorUnit, } #[derive(Clone, Default, Debug, Deserialize, Serialize)] @@ -1155,7 +1148,7 @@ pub struct TrustpayApplePayResponse { #[serde(rename_all = "camelCase")] pub struct ApplePayTotalInfo { pub label: String, - pub amount: String, + pub amount: StringMajorUnit, } impl @@ -1392,7 +1385,7 @@ impl From for api_models::payments::AmountInfo { #[serde(rename_all = "camelCase")] pub struct TrustpayRefundRequestCards { instance_id: String, - amount: String, + amount: StringMajorUnit, currency: String, reference: String, } diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs index 6cae31c3038c..0774f0a85936 100644 --- a/crates/router/src/core/payments/flows/session_flow.rs +++ b/crates/router/src/core/payments/flows/session_flow.rs @@ -1,6 +1,10 @@ use api_models::payments as payment_types; use async_trait::async_trait; -use common_utils::{ext_traits::ByteSliceExt, request::RequestContent}; +use common_utils::{ + ext_traits::ByteSliceExt, + request::RequestContent, + types::{AmountConvertor, StringMajorUnitForConnector}, +}; use error_stack::{Report, ResultExt}; use masking::ExposeInterface; use router_env::metrics::add_attributes; @@ -403,15 +407,16 @@ fn get_apple_pay_amount_info( label: &str, session_data: types::PaymentsSessionData, ) -> RouterResult { + let required_amount_type = StringMajorUnitForConnector; + let apple_pay_amount = required_amount_type + .convert(session_data.minor_amount, session_data.currency) + .change_context(errors::ApiErrorResponse::PreconditionFailed { + message: "Failed to convert amount to string major unit for applePay".to_string(), + })?; let amount_info = payment_types::AmountInfo { label: label.to_string(), total_type: Some("final".to_string()), - amount: session_data - .currency - .to_currency_base_unit(session_data.amount) - .change_context(errors::ApiErrorResponse::PreconditionFailed { - message: "Failed to convert currency to base unit".to_string(), - })?, + amount: apple_pay_amount, }; Ok(amount_info) @@ -548,22 +553,21 @@ fn create_gpay_session_token( }, ) .collect(); - + let required_amount_type = StringMajorUnitForConnector; + let google_pay_amount = required_amount_type + .convert( + router_data.request.minor_amount, + router_data.request.currency, + ) + .change_context(errors::ApiErrorResponse::PreconditionFailed { + message: "Failed to convert amount to string major unit for googlePay".to_string(), + })?; let session_data = router_data.request.clone(); let transaction_info = payment_types::GpayTransactionInfo { country_code: session_data.country.unwrap_or_default(), currency_code: router_data.request.currency, total_price_status: "Final".to_string(), - total_price: router_data - .request - .currency - .to_currency_base_unit(router_data.request.amount) - .attach_printable( - "Cannot convert given amount to base currency denomination".to_string(), - ) - .change_context(errors::ApiErrorResponse::InvalidDataValue { - field_name: "amount", - })?, + total_price: google_pay_amount, }; let required_shipping_contact_fields = diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index 1d257810c5da..e94f52d2c17e 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -1555,6 +1555,7 @@ impl TryFrom> for types::PaymentsSessionD Ok(Self { amount: amount.get_amount_as_i64(), //need to change once we move to connector module + minor_amount: amount, currency: payment_data.currency, country: payment_data.address.get_payment_method_billing().and_then( |billing_address| { diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs index 883693ff63a3..5dcb8db05a5f 100644 --- a/crates/router/src/types/api.rs +++ b/crates/router/src/types/api.rs @@ -437,7 +437,9 @@ impl ConnectorData { Ok(ConnectorEnum::Old(Box::new(&connector::Opennode))) } // "payeezy" => Ok(ConnectorIntegrationEnum::Old(Box::new(&connector::Payeezy)), As psync and rsync are not supported by this connector, it is added as template code for future usage - enums::Connector::Payme => Ok(ConnectorEnum::Old(Box::new(&connector::Payme))), + enums::Connector::Payme => { + Ok(ConnectorEnum::Old(Box::new(connector::Payme::new()))) + } enums::Connector::Payone => Ok(ConnectorEnum::Old(Box::new(&connector::Payone))), enums::Connector::Payu => Ok(ConnectorEnum::Old(Box::new(&connector::Payu))), enums::Connector::Placetopay => { @@ -477,7 +479,7 @@ impl ConnectorData { } enums::Connector::Paypal => Ok(ConnectorEnum::Old(Box::new(&connector::Paypal))), enums::Connector::Trustpay => { - Ok(ConnectorEnum::Old(Box::new(&connector::Trustpay))) + Ok(ConnectorEnum::Old(Box::new(connector::Trustpay::new()))) } enums::Connector::Tsys => Ok(ConnectorEnum::Old(Box::new(&connector::Tsys))), enums::Connector::Volt => Ok(ConnectorEnum::Old(Box::new(&connector::Volt))), diff --git a/crates/router/tests/connectors/payme.rs b/crates/router/tests/connectors/payme.rs index 7c8a7720cd07..590ad15d7f6f 100644 --- a/crates/router/tests/connectors/payme.rs +++ b/crates/router/tests/connectors/payme.rs @@ -17,7 +17,7 @@ impl utils::Connector for PaymeTest { fn get_data(&self) -> types::api::ConnectorData { use router::connector::Payme; utils::construct_connector_data_old( - Box::new(&Payme), + Box::new(Payme::new()), types::Connector::Payme, types::api::GetToken::Connector, None, diff --git a/crates/router/tests/connectors/trustpay.rs b/crates/router/tests/connectors/trustpay.rs index 848797ebf15f..bae62913a9a3 100644 --- a/crates/router/tests/connectors/trustpay.rs +++ b/crates/router/tests/connectors/trustpay.rs @@ -15,7 +15,7 @@ impl utils::Connector for TrustpayTest { fn get_data(&self) -> api::ConnectorData { use router::connector::Trustpay; utils::construct_connector_data_old( - Box::new(&Trustpay), + Box::new(Trustpay::new()), types::Connector::Trustpay, api::GetToken::Connector, None,