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
chore(connectors): remove dead PreProcessing connector-integration flow (#14409)
Hrithikeshf9bb02889857
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen.rs b/crates/hyperswitch_connectors/src/connectors/adyen.rsindex ed79a2a8a9..530ad084c3 100644--- a/crates/hyperswitch_connectors/src/connectors/adyen.rs+++ b/crates/hyperswitch_connectors/src/connectors/adyen.rs@@ -25,8 +25,8 @@ use hyperswitch_domain_models::{ConnectorWebhookGenerateSecret, ConnectorWebhookRegister,},payments::{- Authorize, Capture, ExtendAuthorization, PSync, PaymentMethodToken, PreProcessing,- Session, SetupMandate, Void,+ Authorize, Capture, ExtendAuthorization, PSync, PaymentMethodToken, Session,+ SetupMandate, Void,},refunds::{Execute, RSync},Accept, Defend, Evidence, GiftCardBalanceCheck, Retrieve, Upload,@@ -38,9 +38,8 @@ use hyperswitch_domain_models::{AcceptDisputeRequestData, AccessTokenRequestData, DefendDisputeRequestData,GiftCardBalanceCheckRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,PaymentsCancelData, PaymentsCaptureData, PaymentsExtendAuthorizationData,- PaymentsPreProcessingData, PaymentsSessionData, PaymentsSyncData, RefundsData,- RetrieveFileRequestData, SetupMandateRequestData, SubmitEvidenceRequestData,- SyncRequestType, UploadFileRequestData,+ PaymentsSessionData, PaymentsSyncData, RefundsData, RetrieveFileRequestData,+ SetupMandateRequestData, SubmitEvidenceRequestData, SyncRequestType, UploadFileRequestData,},router_response_types::{merchant_connector_webhook_management::{@@ -55,8 +54,7 @@ use hyperswitch_domain_models::{ConnectorWebhookGenerateSecretRouterData, ConnectorWebhookRegisterRouterData,PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,PaymentsExtendAuthorizationRouterData, PaymentsGiftCardBalanceCheckRouterData,- PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundsRouterData,- SetupMandateRouterData,+ PaymentsSyncRouterData, RefundsRouterData, SetupMandateRouterData,},};#[cfg(feature = "payouts")]@@ -85,8 +83,8 @@ use hyperswitch_interfaces::{types::{AcceptDisputeType, ConnectorWebhookGenerateSecretType, ConnectorWebhookRegisterType,DefendDisputeType, ExtendedAuthorizationType, PaymentsAuthorizeType, PaymentsCaptureType,- PaymentsGiftCardBalanceCheckType, PaymentsPreProcessingType, PaymentsSyncType,- PaymentsVoidType, RefundExecuteType, Response, SetupMandateType, SubmitEvidenceType,+ PaymentsGiftCardBalanceCheckType, PaymentsSyncType, PaymentsVoidType, RefundExecuteType,+ Response, SetupMandateType, SubmitEvidenceType,},webhooks::{IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails, WebhookContext,@@ -980,139 +978,6 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData}}-impl api::PaymentsPreProcessing for Adyen {}--impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Adyen-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {- let mut header = vec![(- headers::CONTENT_TYPE.to_string(),- PaymentsPreProcessingType::get_content_type(self)- .to_string()- .into(),- )];- let mut api_key = self.get_auth_header(&req.connector_auth_type)?;- header.append(&mut api_key);- Ok(header)- }-- fn get_url(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- let endpoint = build_env_specific_endpoint(- self.base_url(connectors),- req.test_mode,- &req.connector_meta_data,- )?;- Ok(format!(- "{endpoint}{ADYEN_API_VERSION}/paymentMethods/balance",- ))- }-- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let connector_req = adyen::AdyenBalanceRequest::try_from(req)?;-- Ok(RequestContent::Json(Box::new(connector_req)))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Post)- .url(&PaymentsPreProcessingType::get_url(self, req, connectors)?)- .attach_default_headers()- .headers(PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .set_body(PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: adyen::AdyenBalanceResponse = res- .response- .parse_struct("AdyenBalanceResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);-- let currency = match data.request.currency {- Some(currency) => currency,- None => Err(errors::ConnectorError::MissingRequiredField {- field_name: "currency".into(),- })?,- };- let amount = data.request.minor_amount;-- let amount = convert_amount(self.amount_converter, amount, currency)?;-- if response.balance.currency != currency || response.balance.value < amount {- Ok(RouterData {- response: Err(ErrorResponse {- code: NO_ERROR_CODE.to_string(),- message: NO_ERROR_MESSAGE.to_string(),- reason: Some(constants::LOW_BALANCE_ERROR_MESSAGE.to_string()),- status_code: res.status_code,- attempt_status: Some(enums::AttemptStatus::Failure),- connector_transaction_id: Some(response.psp_reference),- connector_response_reference_id: None,- network_advice_code: None,- network_decline_code: None,- network_error_message: None,- connector_metadata: None,- }),- ..data.clone()- })- } else {- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- .change_context(errors::ConnectorError::ResponseHandlingFailed)- }- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-- fn get_5xx_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Adyen {fn get_headers(&self,diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rsindex 10a4349bf9..63451eee07 100644--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs@@ -28,7 +28,7 @@ use hyperswitch_domain_models::{},router_data::{ConnectorAuthType, ConnectorResponseData, ErrorResponse, ExtendedAuthorizationResponseData,- PaymentMethodBalance, PaymentMethodToken, RouterData,+ PaymentMethodToken, RouterData,},router_flow_types::{merchant_connector_webhook_management::{@@ -54,7 +54,7 @@ use hyperswitch_domain_models::{ConnectorWebhookGenerateSecretRouterData, ConnectorWebhookRegisterRouterData,PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,PaymentsExtendAuthorizationRouterData, PaymentsGiftCardBalanceCheckRouterData,- PaymentsPreProcessingRouterData, RefundsRouterData,+ RefundsRouterData,},};#[cfg(feature = "payouts")]@@ -77,8 +77,7 @@ use crate::{types::{AcceptDisputeRouterData, DefendDisputeRouterData, PaymentsCancelResponseRouterData,PaymentsCaptureResponseRouterData, PaymentsExtendAuthorizationResponseRouterData,- PaymentsPreprocessingResponseRouterData, RefundsResponseRouterData, ResponseRouterData,- SubmitEvidenceRouterData,+ RefundsResponseRouterData, ResponseRouterData, SubmitEvidenceRouterData,},utils::{self, is_manual_capture, missing_field_err, AddressDetailsData, BrowserInformationData,@@ -1871,40 +1870,6 @@ impl TryFrom<&AdyenRouterData<&PaymentsAuthorizeRouterData>> for AdyenPaymentReq}}-impl TryFrom<&PaymentsPreProcessingRouterData> for AdyenBalanceRequest<'_> {- type Error = Error;- fn try_from(item: &PaymentsPreProcessingRouterData) -> Result<Self, Self::Error> {- let payment_method = match &item.request.payment_method_data {- Some(PaymentMethodData::GiftCard(gift_card_data)) => match gift_card_data.as_ref() {- GiftCardData::Givex(gift_card_data) => {- let balance_pm = BalancePmData {- number: gift_card_data.number.clone(),- cvc: gift_card_data.cvc.clone(),- };- Ok(AdyenPaymentMethod::PaymentMethodBalance(Box::new(- balance_pm,- )))- }- GiftCardData::PaySafeCard {} | GiftCardData::BhnCardNetwork(_) => {- Err(errors::ConnectorError::FlowNotSupported {- flow: "Balance".to_string(),- connector: "adyen".to_string(),- })- }- },- _ => Err(errors::ConnectorError::FlowNotSupported {- flow: "Balance".to_string(),- connector: "adyen".to_string(),- }),- }?;- let auth_type = AdyenAuthType::try_from(&item.connector_auth_type)?;- Ok(Self {- payment_method,- merchant_account: auth_type.merchant_account,- })- }-}-impl TryFrom<&PaymentsGiftCardBalanceCheckRouterData> for AdyenBalanceRequest<'_> {type Error = Error;fn try_from(item: &PaymentsGiftCardBalanceCheckRouterData) -> Result<Self, Self::Error> {@@ -4311,36 +4276,6 @@ impl TryFrom<PaymentsCancelResponseRouterData<AdyenCancelResponse>> for Payments}}-impl TryFrom<PaymentsPreprocessingResponseRouterData<AdyenBalanceResponse>>- for PaymentsPreProcessingRouterData-{- type Error = Error;- fn try_from(- item: PaymentsPreprocessingResponseRouterData<AdyenBalanceResponse>,- ) -> Result<Self, Self::Error> {- Ok(Self {- response: Ok(PaymentsResponseData::TransactionResponse {- resource_id: ResponseId::ConnectorTransactionId(item.response.psp_reference),- redirection_data: Box::new(None),- mandate_reference: Box::new(None),- connector_metadata: None,- network_txn_id: None,- network_txn_link_id: None,- connector_response_reference_id: None,- incremental_authorization_allowed: None,- authentication_data: None,- charges: None,- payment_account_reference: None,- }),- payment_method_balance: Some(PaymentMethodBalance {- currency: item.response.balance.currency,- amount: item.response.balance.value,- }),- ..item.data- })- }-}-implTryFrom<ResponseRouterData<diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard.rsindex d394b29b18..7e55387d3d 100644--- a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs+++ b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs@@ -16,8 +16,8 @@ use hyperswitch_domain_models::{router_flow_types::{access_token_auth::AccessTokenAuth,payments::{- Authorize, Capture, CompleteAuthorize, PSync, PaymentMethodToken, PreProcessing,- Session, SetupMandate, Void,+ Authorize, Capture, CompleteAuthorize, PSync, PaymentMethodToken, Session,+ SetupMandate, Void,},refunds::{Execute, RSync},Authenticate, PostAuthenticate, PreAuthenticate,@@ -25,8 +25,8 @@ use hyperswitch_domain_models::{router_request_types::{AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData,PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,- PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsPreProcessingData,- PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData,+ PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsSessionData,+ PaymentsSyncData, RefundsData, SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -36,8 +36,7 @@ use hyperswitch_domain_models::{PaymentsAuthenticateRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,PaymentsPostAuthenticateRouterData, PaymentsPreAuthenticateRouterData,- PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundSyncRouterData,- RefundsRouterData,+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,},};use hyperswitch_interfaces::{@@ -137,7 +136,6 @@ impl api::PaymentsAuthenticate for Barclaycard {}impl api::PaymentsPreAuthenticate for Barclaycard {}impl api::PaymentsPostAuthenticate for Barclaycard {}impl api::PaymentSession for Barclaycard {}-impl api::PaymentsPreProcessing for Barclaycard {}impl api::ConnectorAccessToken for Barclaycard {}impl api::MandateSetup for Barclaycard {}impl api::PaymentAuthorize for Barclaycard {}@@ -632,114 +630,6 @@ impl ConnectorIntegration<PostAuthenticate, PaymentsPostAuthenticateData, Paymen}}-impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Barclaycard-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {- self.build_headers(req, connectors)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- let redirect_response = req.request.redirect_response.clone().ok_or(- errors::ConnectorError::MissingRequiredField {- field_name: "redirect_response".into(),- },- )?;- match redirect_response.params {- Some(param) if !param.clone().peek().is_empty() => Ok(format!(- "{}risk/v1/authentications",- self.base_url(connectors)- )),- Some(_) | None => Ok(format!(- "{}risk/v1/authentication-results",- self.base_url(connectors)- )),- }- }-- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let amount_in_minor_unit = MinorUnit::new(req.request.amount);- let amount = convert_amount(- self.amount_converter,- amount_in_minor_unit,- req.request- .currency- .ok_or(errors::ConnectorError::MissingRequiredField {- field_name: "currency".into(),- })?,- )?;- let connector_router_data = barclaycard::BarclaycardRouterData::try_from((amount, req))?;- let connector_req =- barclaycard::BarclaycardPreProcessingRequest::try_from(&connector_router_data)?;- Ok(RequestContent::Json(Box::new(connector_req)))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Post)- .url(&types::PaymentsPreProcessingType::get_url(- self, req, connectors,- )?)- .attach_default_headers()- .headers(types::PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .set_body(types::PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: barclaycard::BarclaycardPreProcessingResponse = res- .response- .parse_struct("Barclaycard AuthEnrollmentResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Barclaycard {fn get_headers(&self,diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rsindex 136f64dd1e..c6ba1aed58 100644--- a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs@@ -24,7 +24,7 @@ use hyperswitch_domain_models::{PaymentsAuthenticateRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,PaymentsPostAuthenticateRouterData, PaymentsPreAuthenticateRouterData,- PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundsRouterData,+ PaymentsSyncRouterData, RefundsRouterData,},};use hyperswitch_interfaces::errors;@@ -37,15 +37,14 @@ use crate::{types::{PaymentsAuthenticateResponseRouterData, PaymentsCancelResponseRouterData,PaymentsCaptureResponseRouterData, PaymentsPostAuthenticateResponseRouterData,- PaymentsPreAuthenticateResponseRouterData, PaymentsPreprocessingResponseRouterData,- PaymentsResponseRouterData, PaymentsSyncResponseRouterData, RefundsResponseRouterData,- ResponseRouterData,+ PaymentsPreAuthenticateResponseRouterData, PaymentsResponseRouterData,+ PaymentsSyncResponseRouterData, RefundsResponseRouterData, ResponseRouterData,},unimplemented_payment_method,utils::{self, AddressDetailsData, CardData, ForeignTryFrom, PaymentsAuthorizeRequestData,- PaymentsCompleteAuthorizeRequestData, PaymentsPreProcessingRequestData,- PaymentsSyncRequestData, RouterData as OtherRouterData,+ PaymentsCompleteAuthorizeRequestData, PaymentsSyncRequestData,+ RouterData as OtherRouterData,},};pub struct BarclaycardAuthType {@@ -1036,152 +1035,6 @@ impl TryFrom<&BarclaycardRouterData<&PaymentsPostAuthenticateRouterData>>}}-impl TryFrom<&BarclaycardRouterData<&PaymentsPreProcessingRouterData>>- for BarclaycardPreProcessingRequest-{- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- item: &BarclaycardRouterData<&PaymentsPreProcessingRouterData>,- ) -> Result<Self, Self::Error> {- let client_reference_information = ClientReferenceInformation {- code: Some(item.router_data.connector_request_reference_id.clone()),- };- let payment_method_data = item.router_data.request.payment_method_data.clone().ok_or(- errors::ConnectorError::MissingConnectorRedirectionPayload {- field_name: "payment_method_data".into(),- },- )?;- let payment_information = match payment_method_data {- PaymentMethodData::Card(ccard) => {- let card_type = match ccard- .card_network- .clone()- .and_then(get_barclaycard_card_type)- {- Some(card_network) => Some(card_network.to_string()),- None => ccard.get_card_issuer().ok().map(String::from),- };-- Ok(PaymentInformation::Cards(Box::new(- CardPaymentInformation {- card: Card {- number: ccard.card_number,- expiration_month: ccard.card_exp_month,- expiration_year: ccard.card_exp_year,- security_code: ccard.card_cvc,- card_type,- type_selection_indicator: Some("1".to_owned()),- },- },- )))- }- PaymentMethodData::Wallet(_)- | PaymentMethodData::CardRedirect(_)- | PaymentMethodData::PayLater(_)- | PaymentMethodData::BankRedirect(_)- | PaymentMethodData::BankDebit(_)- | PaymentMethodData::BankTransfer(_)- | PaymentMethodData::Crypto(_)- | PaymentMethodData::MandatePayment- | PaymentMethodData::Reward- | PaymentMethodData::RealTimePayment(_)- | PaymentMethodData::MobilePayment(_)- | PaymentMethodData::Upi(_)- | PaymentMethodData::Voucher(_)- | PaymentMethodData::GiftCard(_)- | PaymentMethodData::OpenBanking(_)- | PaymentMethodData::CardToken(_)- | PaymentMethodData::NetworkToken(_)- | PaymentMethodData::CardDetailsForNetworkTransactionId(_)- | PaymentMethodData::CardWithOptionalCVC(_)- | PaymentMethodData::CardWithNetworkTokenDetails(_)- | PaymentMethodData::CardWithLimitedDetails(_)- | PaymentMethodData::DecryptedWalletTokenDetailsForNetworkTransactionId(_)- | PaymentMethodData::NetworkTokenDetailsForNetworkTransactionId(_) => {- Err(errors::ConnectorError::NotImplemented(- utils::get_unimplemented_payment_method_error_message("Barclaycard"),- ))- }- }?;-- let redirect_response = item.router_data.request.redirect_response.clone().ok_or(- errors::ConnectorError::MissingRequiredField {- field_name: "redirect_response".into(),- },- )?;-- let amount_details = Amount {- total_amount: item.amount.clone(),- currency: item.router_data.request.currency.ok_or(- errors::ConnectorError::MissingRequiredField {- field_name: "currency".into(),- },- )?,- };-- match redirect_response.params {- Some(param) if !param.clone().peek().is_empty() => {- let reference_id = param- .clone()- .peek()- .split_once('=')- .ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload {- field_name: "request.redirect_response.params.reference_id".into(),- })?- .1- .to_string();- let email = item- .router_data- .get_billing_email()- .or(item.router_data.request.get_email())?;- let bill_to = build_bill_to(item.router_data.get_billing_address()?, email)?;- let order_information = OrderInformationWithBill {- amount_details,- bill_to: Some(bill_to),- };- Ok(Self::AuthEnrollment(Box::new(- BarclaycardAuthEnrollmentRequest {- payment_information,- client_reference_information,- consumer_authentication_information:- BarclaycardConsumerAuthInformationRequest {- return_url: item- .router_data- .request- .get_complete_authorize_url()?,- reference_id,- },- order_information,- },- )))- }- Some(_) | None => {- let redirect_payload: BarclaycardRedirectionAuthResponse = redirect_response- .payload- .ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload {- field_name: "request.redirect_response.payload".into(),- })?- .peek()- .clone()- .parse_value("BarclaycardRedirectionAuthResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- let order_information = OrderInformation { amount_details };- Ok(Self::AuthValidate(Box::new(- BarclaycardAuthValidateRequest {- payment_information,- client_reference_information,- consumer_authentication_information:- BarclaycardConsumerAuthInformationValidateRequest {- authentication_transaction_id: redirect_payload.transaction_id,- },- order_information,- },- )))- }- }- }-}-impl TryFrom<PaymentsPreAuthenticateResponseRouterData<BarclaycardPreProcessingResponse>>for PaymentsPreAuthenticateRouterData{@@ -1560,132 +1413,6 @@ impl TryFrom<PaymentsPostAuthenticateResponseRouterData<BarclaycardAuthenticatio}}-impl TryFrom<PaymentsPreprocessingResponseRouterData<BarclaycardPreProcessingResponse>>- for PaymentsPreProcessingRouterData-{- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- item: PaymentsPreprocessingResponseRouterData<BarclaycardPreProcessingResponse>,- ) -> Result<Self, Self::Error> {- match item.response {- BarclaycardPreProcessingResponse::ClientAuthCheckInfo(info_response) => {- let status = enums::AttemptStatus::from(info_response.status);- let risk_info: Option<ClientRiskInformation> = None;- if utils::is_payment_failure(status) {- let response = Err(get_error_response(- &info_response.error_information,- &None,- &risk_info,- Some(status),- item.http_code,- info_response.id.clone(),- ));-- Ok(Self {- status,- response,- ..item.data- })- } else {- let connector_response_reference_id = Some(- info_response- .client_reference_information- .code- .unwrap_or(info_response.id.clone()),- );-- let redirection_data = match (- info_response- .consumer_authentication_information- .access_token,- info_response- .consumer_authentication_information- .step_up_url,- ) {- (Some(token), Some(step_up_url)) => {- Some(RedirectForm::BarclaycardConsumerAuth {- access_token: token.expose(),- step_up_url,- })- }- _ => None,- };- let validate_response = &info_response- .consumer_authentication_information- .validate_response;- let three_ds_data = serde_json::to_value(validate_response)- .change_context(errors::ConnectorError::ResponseHandlingFailed)?;- let authentication_data =- UcsAuthenticationData::foreign_try_from(validate_response)- .ok()- .map(Box::new);- Ok(Self {- status,- response: Ok(PaymentsResponseData::TransactionResponse {- resource_id: ResponseId::NoResponseId,- redirection_data: Box::new(redirection_data),- mandate_reference: Box::new(None),- connector_metadata: Some(serde_json::json!({- "three_ds_data": three_ds_data- })),- network_txn_id: None,- network_txn_link_id: None,- connector_response_reference_id,- incremental_authorization_allowed: None,- authentication_data,- charges: None,- payment_account_reference: None,- }),- ..item.data- })- }- }- BarclaycardPreProcessingResponse::ErrorInformation(error_response) => {- let detailed_error_info =- error_response- .error_information- .details- .to_owned()- .map(|details| {- details- .iter()- .map(|details| format!("{} : {}", details.field, details.reason))- .collect::<Vec<_>>()- .join(", ")- });-- let reason = get_error_reason(- error_response.error_information.message,- detailed_error_info,- None,- );- let error_message = error_response.error_information.reason.to_owned();- let response = Err(ErrorResponse {- code: error_message- .clone()- .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),- message: error_message- .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),- reason,- status_code: item.http_code,- attempt_status: None,- connector_transaction_id: Some(error_response.id.clone()),- connector_response_reference_id: None,- network_advice_code: None,- network_decline_code: None,- network_error_message: None,- connector_metadata: None,- });- Ok(Self {- response,- status: enums::AttemptStatus::AuthenticationFailed,- ..item.data- })- }- }- }-}-fn extract_score_id(message_extensions: &[MessageExtensionAttribute]) -> Option<u32> {message_extensions.iter().find_map(|attr| {attr.iddiff --git a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rsindex 6891f7d4fa..1155d8173b 100644--- a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs+++ b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs@@ -13,17 +13,14 @@ use hyperswitch_domain_models::{router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},router_flow_types::{access_token_auth::AccessTokenAuth,- payments::{- Authorize, Capture, PSync, PaymentMethodToken, PreProcessing, Session, SetupMandate,- Void,- },+ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},refunds::{Execute, RSync},GiftCardBalanceCheck,},router_request_types::{AccessTokenRequestData, GiftCardBalanceCheckRequestData, PaymentMethodTokenizationData,- PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData,- PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData,+ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,+ PaymentsSyncData, RefundsData, SetupMandateRequestData,},router_response_types::{ConnectorInfo, GiftCardBalanceCheckResponseData, PaymentMethodDetails,@@ -32,8 +29,8 @@ use hyperswitch_domain_models::{},types::{PaymentsAuthorizeRouterData, PaymentsCaptureRouterData,- PaymentsGiftCardBalanceCheckRouterData, PaymentsPreProcessingRouterData,- PaymentsSyncRouterData, RefreshTokenRouterData, RefundSyncRouterData, RefundsRouterData,+ PaymentsGiftCardBalanceCheckRouterData, PaymentsSyncRouterData, RefreshTokenRouterData,+ RefundSyncRouterData, RefundsRouterData,},};use hyperswitch_interfaces::{@@ -78,7 +75,6 @@ impl api::Refund for Blackhawknetwork {}impl api::RefundExecute for Blackhawknetwork {}impl api::RefundSync for Blackhawknetwork {}impl api::PaymentToken for Blackhawknetwork {}-impl api::PaymentsPreProcessing for Blackhawknetwork {}impl api::PaymentsGiftCardBalanceCheck for Blackhawknetwork {}impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>@@ -339,78 +335,6 @@ impl}}-impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Blackhawknetwork-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {- let mut headers = vec![(- headers::CONTENT_TYPE.to_string(),- "application/x-www-form-urlencoded".to_string().into(),- )];- let mut auth_header = self.get_auth_header(&req.connector_auth_type)?;- headers.append(&mut auth_header);- Ok(headers)- }-- fn get_url(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- let base_url = self.base_url(connectors);- let connector_req = blackhawknetwork::BlackhawknetworkVerifyAccountRequest::try_from(req)?;- let query = serde_urlencoded::to_string(&connector_req)- .change_context(errors::ConnectorError::RequestEncodingFailed)?;- Ok(format!(- "{base_url}/accountProcessing/v1/verifyAccount?{query}"- ))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Get)- .url(&types::PaymentsPreProcessingType::get_url(- self, req, connectors,- )?)- .attach_default_headers()- .headers(types::PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: blackhawknetwork::BlackhawknetworkVerifyAccountResponse = res- .response- .parse_struct("BlackhawknetworkVerifyAccountResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);-- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- .change_context(errors::ConnectorError::ResponseHandlingFailed)- }-}-impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>for Blackhawknetwork{diff --git a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rsindex 77e12f9c5a..662e55c158 100644--- a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs@@ -3,30 +3,24 @@ use common_utils::types::{MinorUnit, StringMajorUnit};use error_stack::ResultExt;use hyperswitch_domain_models::{payment_method_data::{GiftCardData, PaymentMethodData},- router_data::{- AccessToken, ConnectorAuthType, ErrorResponse, PaymentMethodBalance, RouterData,- },+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},router_flow_types::{refunds::{Execute, RSync},GiftCardBalanceCheck,},router_request_types::{GiftCardBalanceCheckRequestData, ResponseId},router_response_types::{- GiftCardBalanceCheckResponseData, PaymentsResponseData, PreprocessingResponseId,- RefundsResponseData,+ GiftCardBalanceCheckResponseData, PaymentsResponseData, RefundsResponseData,},types::{- PaymentsAuthorizeRouterData, PaymentsGiftCardBalanceCheckRouterData,- PaymentsPreProcessingRouterData, RefundsRouterData,+ PaymentsAuthorizeRouterData, PaymentsGiftCardBalanceCheckRouterData, RefundsRouterData,},};use hyperswitch_interfaces::{consts::NO_ERROR_MESSAGE, errors};use hyperswitch_masking::Secret;use serde::{Deserialize, Serialize};-use crate::types::{- PaymentsPreprocessingResponseRouterData, RefundsResponseRouterData, ResponseRouterData,-};+use crate::types::{RefundsResponseRouterData, ResponseRouterData};pub struct BlackhawknetworkRouterData<T> {pub amount: StringMajorUnit,@@ -142,43 +136,6 @@ impl TryFrom<&PaymentsGiftCardBalanceCheckRouterData> for BlackhawknetworkVerify})}}-impl TryFrom<&PaymentsPreProcessingRouterData> for BlackhawknetworkVerifyAccountRequest {- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(item: &PaymentsPreProcessingRouterData) -> Result<Self, Self::Error> {- let auth = BlackhawknetworkAuthType::try_from(&item.connector_auth_type)- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;-- let gift_card_data = match &item.request.payment_method_data {- Some(PaymentMethodData::GiftCard(gc)) => match gc.as_ref() {- GiftCardData::BhnCardNetwork(data) => data,- _ => {- return Err(errors::ConnectorError::FlowNotSupported {- flow: "Balance".to_string(),- connector: "BlackHawkNetwork".to_string(),- }- .into())- }- },- _ => {- return Err(errors::ConnectorError::FlowNotSupported {- flow: "Balance".to_string(),- connector: "BlackHawkNetwork".to_string(),- }- .into())- }- };-- Ok(Self {- account_number: gift_card_data.account_number.clone(),- product_line_id: auth.product_line_id,- account_type: AccountType::GiftCard,- pin: gift_card_data.pin.clone(),- cvv2: gift_card_data.cvv2.clone(),- expiration_date: gift_card_data.expiration_date.clone().map(Secret::new),- })- }-}-implTryFrom<ResponseRouterData<@@ -213,31 +170,6 @@ impl}}-impl TryFrom<PaymentsPreprocessingResponseRouterData<BlackhawknetworkVerifyAccountResponse>>- for PaymentsPreProcessingRouterData-{- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- item: PaymentsPreprocessingResponseRouterData<BlackhawknetworkVerifyAccountResponse>,- ) -> Result<Self, Self::Error> {- Ok(Self {- response: Ok(PaymentsResponseData::PreProcessingResponse {- pre_processing_id: PreprocessingResponseId::PreProcessingId(- item.response.account.entity_id,- ),- connector_metadata: None,- session_token: None,- connector_response_reference_id: None,- }),- payment_method_balance: Some(PaymentMethodBalance {- currency: item.response.account.currency,- amount: item.response.account.balance,- }),- ..item.data- })- }-}-#[derive(Debug, Serialize, Deserialize)]pub struct BlackhawknetworkTokenResponse {pub access_token: Secret<String>,diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource.rs b/crates/hyperswitch_connectors/src/connectors/cybersource.rsindex e73c48a5ab..224169e6d6 100644--- a/crates/hyperswitch_connectors/src/connectors/cybersource.rs+++ b/crates/hyperswitch_connectors/src/connectors/cybersource.rs@@ -22,14 +22,14 @@ use hyperswitch_domain_models::{PaymentMethodToken, Session, SetupMandate, Void,},refunds::{Execute, RSync},- Authenticate, PostAuthenticate, PreAuthenticate, PreProcessing,+ Authenticate, PostAuthenticate, PreAuthenticate,},router_request_types::{AccessTokenRequestData, CompleteAuthorizeData, MandateRevokeRequestData,PaymentMethodTokenizationData, PaymentsAuthenticateData, PaymentsAuthorizeData,PaymentsCancelData, PaymentsCaptureData, PaymentsIncrementalAuthorizationData,- PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsPreProcessingData,- PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData,+ PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsSessionData,+ PaymentsSyncData, RefundsData, SetupMandateRequestData,},router_response_types::{ConnectorInfo, MandateRevokeResponseData, PaymentMethodDetails, PaymentsResponseData,@@ -39,8 +39,8 @@ use hyperswitch_domain_models::{MandateRevokeRouterData, PaymentsAuthenticateRouterData, PaymentsAuthorizeRouterData,PaymentsCancelRouterData, PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,PaymentsIncrementalAuthorizationRouterData, PaymentsPostAuthenticateRouterData,- PaymentsPreAuthenticateRouterData, PaymentsPreProcessingRouterData, PaymentsSyncRouterData,- RefundExecuteRouterData, RefundSyncRouterData, SetupMandateRouterData,+ PaymentsPreAuthenticateRouterData, PaymentsSyncRouterData, RefundExecuteRouterData,+ RefundSyncRouterData, SetupMandateRouterData,},};#[cfg(feature = "payouts")]@@ -65,9 +65,8 @@ use hyperswitch_interfaces::{types::{IncrementalAuthorizationType, MandateRevokeType, PaymentsAuthenticateType,PaymentsAuthorizeType, PaymentsCaptureType, PaymentsCompleteAuthorizeType,- PaymentsPostAuthenticateType, PaymentsPreAuthenticateType, PaymentsPreProcessingType,- PaymentsSyncType, PaymentsVoidType, RefundExecuteType, RefundSyncType, Response,- SetupMandateType,+ PaymentsPostAuthenticateType, PaymentsPreAuthenticateType, PaymentsSyncType,+ PaymentsVoidType, RefundExecuteType, RefundSyncType, Response, SetupMandateType,},webhooks,};@@ -399,7 +398,6 @@ impl api::PaymentIncrementalAuthorization for Cybersource {}impl api::MandateSetup for Cybersource {}impl api::ConnectorAccessToken for Cybersource {}impl api::PaymentToken for Cybersource {}-impl api::PaymentsPreProcessing for Cybersource {}impl api::PaymentsCompleteAuthorize for Cybersource {}impl api::ConnectorMandateRevoke for Cybersource {}@@ -658,106 +656,6 @@ impl PaymentSession for Cybersource {}impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Cybersource {}-impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Cybersource-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {- self.build_headers(req, connectors)- }- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }- fn get_url(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- let redirect_response = req.request.redirect_response.clone().ok_or(- errors::ConnectorError::MissingRequiredField {- field_name: "redirect_response".into(),- },- )?;- match redirect_response.params {- Some(param) if !param.clone().peek().is_empty() => Ok(format!(- "{}risk/v1/authentications",- self.base_url(connectors)- )),- Some(_) | None => Ok(format!(- "{}risk/v1/authentication-results",- self.base_url(connectors)- )),- }- }- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let minor_amount = req.request.minor_amount;- let currency =- req.request- .currency- .ok_or(errors::ConnectorError::MissingRequiredField {- field_name: "currency".into(),- })?;- let amount = convert_amount(self.amount_converter, minor_amount, currency)?;- let connector_router_data = cybersource::CybersourceRouterData::from((amount, req));- let connector_req =- cybersource::CybersourcePreProcessingRequest::try_from(&connector_router_data)?;- Ok(RequestContent::Json(Box::new(connector_req)))- }- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Post)- .url(&PaymentsPreProcessingType::get_url(self, req, connectors)?)- .attach_default_headers()- .headers(PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .set_body(PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: cybersource::CybersourcePreProcessingResponse = res- .response- .parse_struct("Cybersource AuthEnrollmentResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>for Cybersource{diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rsindex 8c165e5e1d..4d74e4f7af 100644--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs@@ -45,8 +45,8 @@ use hyperswitch_domain_models::{PaymentsAuthenticateRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,PaymentsIncrementalAuthorizationRouterData, PaymentsPostAuthenticateRouterData,- PaymentsPreAuthenticateRouterData, PaymentsPreProcessingRouterData, PaymentsSyncRouterData,- RefundsRouterData, SetupMandateRouterData,+ PaymentsPreAuthenticateRouterData, PaymentsSyncRouterData, RefundsRouterData,+ SetupMandateRouterData,},};use hyperswitch_interfaces::{api, errors};@@ -63,15 +63,15 @@ use crate::{constants,types::{PaymentsCancelResponseRouterData, PaymentsCaptureResponseRouterData,- PaymentsPreprocessingResponseRouterData, PaymentsResponseRouterData,- PaymentsSyncResponseRouterData, RefundsResponseRouterData, ResponseRouterData,+ PaymentsResponseRouterData, PaymentsSyncResponseRouterData, RefundsResponseRouterData,+ ResponseRouterData,},unimplemented_payment_method,utils::{self, AddressDetailsData, BrowserInformationData, CardData, CardIssuer,NetworkTokenData as _, PaymentsAuthorizeRequestData, PaymentsCompleteAuthorizeRequestData,- PaymentsPreProcessingRequestData, PaymentsSetupMandateRequestData, PaymentsSyncRequestData,- RecurringMandateData, RouterData as OtherRouterData,+ PaymentsSetupMandateRequestData, PaymentsSyncRequestData, RecurringMandateData,+ RouterData as OtherRouterData,},};@@ -3808,193 +3808,6 @@ pub struct CybersourceAuthValidateRequest {processing_information: Option<CybersourcePayerAuthProcessingInformation>,}-#[derive(Debug, Serialize)]-#[serde(untagged)]-pub enum CybersourcePreProcessingRequest {- AuthEnrollment(Box<CybersourceAuthEnrollmentRequest>),- AuthValidate(Box<CybersourceAuthValidateRequest>),-}--impl TryFrom<&CybersourceRouterData<&PaymentsPreProcessingRouterData>>- for CybersourcePreProcessingRequest-{- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- item: &CybersourceRouterData<&PaymentsPreProcessingRouterData>,- ) -> Result<Self, Self::Error> {- let client_reference_information = ClientReferenceInformation {- code: Some(item.router_data.connector_request_reference_id.clone()),- };- let payment_method_data = item.router_data.request.payment_method_data.clone().ok_or(- errors::ConnectorError::MissingConnectorRedirectionPayload {- field_name: "payment_method_data".into(),- },- )?;- let (payment_information, payment_solution) = match payment_method_data {- PaymentMethodData::Card(ccard) => {- let card_type = match ccard- .card_network- .clone()- .and_then(get_cybersource_card_type)- {- Some(card_network) => Some(card_network.to_string()),- None => ccard.get_card_issuer().ok().map(String::from),- };-- Ok((- PaymentInformation::Cards(Box::new(CardPaymentInformation {- card: Card {- number: ccard.card_number,- expiration_month: ccard.card_exp_month,- expiration_year: ccard.card_exp_year,- security_code: get_optional_security_code(ccard.card_cvc),- card_type,- type_selection_indicator: Some("1".to_owned()),- },- })),- None,- ))- }- PaymentMethodData::Wallet(WalletData::GooglePay(gpay_data)) => Ok((- PaymentInformation::try_from(&gpay_data)?,- Some(String::from(PaymentSolution::GooglePay)),- )),- PaymentMethodData::Wallet(_)- | PaymentMethodData::CardRedirect(_)- | PaymentMethodData::PayLater(_)- | PaymentMethodData::BankRedirect(_)- | PaymentMethodData::BankDebit(_)- | PaymentMethodData::BankTransfer(_)- | PaymentMethodData::Crypto(_)- | PaymentMethodData::MandatePayment- | PaymentMethodData::Reward- | PaymentMethodData::RealTimePayment(_)- | PaymentMethodData::MobilePayment(_)- | PaymentMethodData::Upi(_)- | PaymentMethodData::Voucher(_)- | PaymentMethodData::GiftCard(_)- | PaymentMethodData::OpenBanking(_)- | PaymentMethodData::CardToken(_)- | PaymentMethodData::NetworkToken(_)- | PaymentMethodData::CardDetailsForNetworkTransactionId(_)- | PaymentMethodData::CardWithOptionalCVC(_)- | PaymentMethodData::CardWithNetworkTokenDetails(_)- | PaymentMethodData::CardWithLimitedDetails(_)- | PaymentMethodData::DecryptedWalletTokenDetailsForNetworkTransactionId(_)- | PaymentMethodData::NetworkTokenDetailsForNetworkTransactionId(_) => {- Err(errors::ConnectorError::NotImplemented(- utils::get_unimplemented_payment_method_error_message("Cybersource"),- ))- }- }?;-- let redirect_response = item.router_data.request.redirect_response.clone().ok_or(- errors::ConnectorError::MissingRequiredField {- field_name: "redirect_response".into(),- },- )?;-- let amount_details = Amount {- total_amount: item.amount.clone(),- currency: item.router_data.request.currency.ok_or(- errors::ConnectorError::MissingRequiredField {- field_name: "currency".into(),- },- )?,- };-- match redirect_response.params {- Some(param) if !param.clone().peek().is_empty() => {- let reference_id = param- .clone()- .peek()- .split_once('=')- .ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload {- field_name: "request.redirect_response.params.reference_id".into(),- })?- .1- .to_string();- let email = item- .router_data- .get_billing_email()- .or(item.router_data.request.get_email())?;- let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?;- let order_information = OrderInformationWithBill {- amount_details,- bill_to: Some(bill_to),- };- let is_wallet_payer_auth = payment_solution.is_some();- let processing_information =- payment_solution.map(|solution| CybersourcePayerAuthProcessingInformation {- payment_solution: Some(solution),- });- let (device_information, challenge_code, device_channel) = if is_wallet_payer_auth {- (- get_cybersource_device_information(- item.router_data.request.browser_info.as_ref(),- )?,- get_payer_auth_challenge_code(item.router_data.request.force_3ds_challenge),- item.router_data- .request- .device_channel- .as_ref()- .map(CybersourceDeviceChannel::from),- )- } else {- (None, None, None)- };- Ok(Self::AuthEnrollment(Box::new(- CybersourceAuthEnrollmentRequest {- payment_information,- client_reference_information,- consumer_authentication_information:- CybersourceConsumerAuthInformationRequest {- return_url: item- .router_data- .request- .get_complete_authorize_url()?,- reference_id,- challenge_code,- device_channel,- },- order_information,- processing_information,- device_information,- },- )))- }- Some(_) | None => {- let redirect_payload: CybersourceRedirectionAuthResponse = redirect_response- .payload- .ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload {- field_name: "request.redirect_response.payload".into(),- })?- .peek()- .clone()- .parse_value("CybersourceRedirectionAuthResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- let order_information = OrderInformation { amount_details };- let processing_information =- payment_solution.map(|solution| CybersourcePayerAuthProcessingInformation {- payment_solution: Some(solution),- });- Ok(Self::AuthValidate(Box::new(- CybersourceAuthValidateRequest {- payment_information,- client_reference_information,- consumer_authentication_information:- CybersourceConsumerAuthInformationValidateRequest {- authentication_transaction_id: redirect_payload.transaction_id,- },- order_information,- processing_information,- },- )))- }- }- }-}-impl TryFrom<&CybersourceRouterData<&PaymentsAuthenticateRouterData>>for CybersourceAuthEnrollmentRequest{@@ -4455,13 +4268,6 @@ pub struct ClientAuthCheckInfoResponse {error_information: Option<CybersourceErrorInformation>,}-#[derive(Debug, Deserialize, Serialize)]-#[serde(untagged)]-pub enum CybersourcePreProcessingResponse {- ClientAuthCheckInfo(Box<ClientAuthCheckInfoResponse>),- ErrorInformation(Box<CybersourceErrorInformationResponse>),-}-#[derive(Debug, Deserialize, Serialize)]#[serde(untagged)]pub enum CybersourceAuthenticateResponse {@@ -4493,132 +4299,6 @@ fn get_auth_enrollment_status(}}-impl TryFrom<PaymentsPreprocessingResponseRouterData<CybersourcePreProcessingResponse>>- for PaymentsPreProcessingRouterData-{- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- item: PaymentsPreprocessingResponseRouterData<CybersourcePreProcessingResponse>,- ) -> Result<Self, Self::Error> {- match item.response {- CybersourcePreProcessingResponse::ClientAuthCheckInfo(info_response) => {- let status = get_auth_enrollment_status(info_response.status, item.data.status);- let risk_info: Option<ClientRiskInformation> = None;- if utils::is_payment_failure(status) {- let response = Err(get_error_response(- &info_response.error_information,- &None,- &risk_info,- Some(status),- item.http_code,- info_response.id.clone(),- ));-- Ok(Self {- status,- response,- ..item.data- })- } else {- let connector_response_reference_id = Some(- info_response- .client_reference_information- .code- .unwrap_or(info_response.id.clone()),- );-- let redirection_data = match (- info_response- .consumer_authentication_information- .access_token,- info_response- .consumer_authentication_information- .step_up_url,- ) {- (Some(token), Some(step_up_url)) => {- Some(RedirectForm::CybersourceConsumerAuth {- access_token: token.expose(),- step_up_url,- })- }- _ => None,- };- let validate_response = &info_response- .consumer_authentication_information- .validate_response;- let three_ds_data = serde_json::to_value(validate_response)- .change_context(errors::ConnectorError::ResponseHandlingFailed)?;- let authentication_data =- UcsAuthenticationData::foreign_try_from(validate_response)- .ok()- .map(Box::new);- Ok(Self {- status,- response: Ok(PaymentsResponseData::TransactionResponse {- resource_id: ResponseId::NoResponseId,- redirection_data: Box::new(redirection_data),- mandate_reference: Box::new(None),- connector_metadata: Some(serde_json::json!({- "three_ds_data": three_ds_data- })),- network_txn_id: None,- network_txn_link_id: None,- connector_response_reference_id,- incremental_authorization_allowed: None,- authentication_data,- charges: None,- payment_account_reference: None,- }),- ..item.data- })- }- }- CybersourcePreProcessingResponse::ErrorInformation(error_response) => {- let detailed_error_info =- error_response- .error_information- .details- .to_owned()- .map(|details| {- details- .iter()- .map(|details| format!("{} : {}", details.field, details.reason))- .collect::<Vec<_>>()- .join(", ")- });-- let reason = get_error_reason(- error_response.error_information.message,- detailed_error_info,- None,- );- let error_message = error_response.error_information.reason.to_owned();- let response = Err(ErrorResponse {- code: error_message- .clone()- .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),- message: error_message- .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),- reason,- status_code: item.http_code,- attempt_status: None,- connector_transaction_id: Some(error_response.id.clone()),- connector_response_reference_id: None,- network_advice_code: None,- network_decline_code: None,- network_error_message: None,- connector_metadata: None,- });- Ok(Self {- response,- status: enums::AttemptStatus::AuthenticationFailed,- ..item.data- })- }- }- }-}-impl<F>TryFrom<ResponseRouterData<diff --git a/crates/hyperswitch_connectors/src/connectors/gocardless.rs b/crates/hyperswitch_connectors/src/connectors/gocardless.rsindex 61956781ca..8749d9d72e 100644--- a/crates/hyperswitch_connectors/src/connectors/gocardless.rs+++ b/crates/hyperswitch_connectors/src/connectors/gocardless.rs@@ -18,12 +18,12 @@ use hyperswitch_domain_models::{access_token_auth::AccessTokenAuth,payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},refunds::{Execute, RSync},- CreateConnectorCustomer, PreProcessing,+ CreateConnectorCustomer,},router_request_types::{AccessTokenRequestData, ConnectorCustomerData, PaymentMethodTokenizationData,- PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData,- PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData,+ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,+ PaymentsSyncData, RefundsData, SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -80,7 +80,6 @@ impl api::RefundExecute for Gocardless {}impl api::RefundSync for Gocardless {}impl api::PaymentToken for Gocardless {}impl api::ConnectorCustomer for Gocardless {}-impl api::PaymentsPreProcessing for Gocardless {}const GOCARDLESS_VERSION: &str = "2015-07-06";const GOCARDLESS_VERSION_HEADER: &str = "GoCardless-Version";@@ -352,11 +351,6 @@ impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, Pay}}-impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Gocardless-{-}-impl ConnectorValidation for Gocardless {}impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Gocardless {diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay.rsindex a0513e74b0..eb29ce074f 100644--- a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs@@ -13,8 +13,8 @@ use hyperswitch_domain_models::{router_flow_types::{access_token_auth::AccessTokenAuth,payments::{- Authorize, Capture, CompleteAuthorize, PSync, PaymentMethodToken, PreProcessing,- Session, SetupMandate, Void,+ Authorize, Capture, CompleteAuthorize, PSync, PaymentMethodToken, Session,+ SetupMandate, Void,},refunds::{Execute, RSync},unified_authentication_service::PostAuthenticate,@@ -23,8 +23,8 @@ use hyperswitch_domain_models::{router_request_types::{AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData,PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,- PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsPreProcessingData,- PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData,+ PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsSessionData,+ PaymentsSyncData, RefundsData, SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -33,8 +33,8 @@ use hyperswitch_domain_models::{types::{PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,PaymentsCompleteAuthorizeRouterData, PaymentsPostAuthenticateRouterData,- PaymentsPreAuthenticateRouterData, PaymentsPreProcessingRouterData, PaymentsSyncRouterData,- RefundSyncRouterData, RefundsRouterData, SetupMandateRouterData,+ PaymentsPreAuthenticateRouterData, PaymentsSyncRouterData, RefundSyncRouterData,+ RefundsRouterData, SetupMandateRouterData,},};use hyperswitch_interfaces::{@@ -85,7 +85,6 @@ impl Nexixpay {}impl api::Payment for Nexixpay {}-impl api::PaymentsPreProcessing for Nexixpay {}impl api::PaymentSession for Nexixpay {}impl api::ConnectorAccessToken for Nexixpay {}impl api::MandateSetup for Nexixpay {}@@ -536,92 +535,6 @@ impl ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, Payments}}-impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Nexixpay-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError>- {- self.build_headers(req, connectors)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- _req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- Ok(format!(- "{}/orders/3steps/validation",- self.base_url(connectors)- ))- }-- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let connector_req = nexixpay::NexixpayRedirectRequest::try_from(req)?;- Ok(RequestContent::Json(Box::new(connector_req)))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Post)- .url(&types::PaymentsPreProcessingType::get_url(- self, req, connectors,- )?)- .attach_default_headers()- .headers(types::PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .set_body(types::PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: nexixpay::NexixpayRedirectionResponse = res- .response- .parse_struct("NexixpayRedirectionResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>for Nexixpay{diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rsindex 701f2e7079..3ad01c4ee6 100644--- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs@@ -29,8 +29,7 @@ use hyperswitch_domain_models::{types::{PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,PaymentsCompleteAuthorizeRouterData, PaymentsPostAuthenticateRouterData,- PaymentsPreAuthenticateRouterData, PaymentsPreProcessingRouterData, PaymentsSyncRouterData,- RefundsRouterData,+ PaymentsPreAuthenticateRouterData, PaymentsSyncRouterData, RefundsRouterData,},};use hyperswitch_interfaces::{consts::NO_ERROR_CODE, errors};@@ -43,15 +42,14 @@ use crate::{types::{PaymentsCancelResponseRouterData, PaymentsCaptureResponseRouterData,PaymentsPostAuthenticateResponseRouterData, PaymentsPreAuthenticateResponseRouterData,- PaymentsPreprocessingResponseRouterData, PaymentsResponseRouterData,- PaymentsSyncResponseRouterData, RefundsResponseRouterData, ResponseRouterData,+ PaymentsResponseRouterData, PaymentsSyncResponseRouterData, RefundsResponseRouterData,+ ResponseRouterData,},utils::{get_unimplemented_payment_method_error_message, to_connector_meta,to_connector_meta_from_secret, CardData, ForeignTryFrom, PaymentsAuthorizeRequestData,PaymentsCompleteAuthorizeRequestData, PaymentsPostAuthenticateRequestData,- PaymentsPreProcessingRequestData, PaymentsSetupMandateRequestData, PaymentsSyncRequestData,- RouterData as _,+ PaymentsSetupMandateRequestData, PaymentsSyncRequestData, RouterData as _,},};@@ -684,33 +682,6 @@ pub struct RedirectPayload {payment_id: Option<String>,}-impl TryFrom<&PaymentsPreProcessingRouterData> for NexixpayRedirectRequest {- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(item: &PaymentsPreProcessingRouterData) -> Result<Self, Self::Error> {- let redirect_response = item.request.redirect_response.clone().ok_or(- errors::ConnectorError::MissingRequiredField {- field_name: "redirect_response".into(),- },- )?;- let redirect_payload = redirect_response- .payload- .ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload {- field_name: "request.redirect_response.payload".into(),- })?- .expose();- let customer_details_encrypted: RedirectPayload =- serde_json::from_value::<RedirectPayload>(redirect_payload.clone()).change_context(- errors::ConnectorError::MissingConnectorRedirectionPayload {- field_name: "redirection_payload".into(),- },- )?;- Ok(Self {- operation_id: customer_details_encrypted.payment_id,- three_d_s_auth_response: customer_details_encrypted.pa_res,- })- }-}-impl TryFrom<&PaymentsPostAuthenticateRouterData> for NexixpayRedirectRequest {type Error = error_stack::Report<errors::ConnectorError>;fn try_from(item: &PaymentsPostAuthenticateRouterData) -> Result<Self, Self::Error> {@@ -803,32 +774,6 @@ fn process_nexixpay_preprocessing_response(Ok((status, result))}-impl TryFrom<PaymentsPreprocessingResponseRouterData<NexixpayRedirectionResponse>>- for PaymentsPreProcessingRouterData-{- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- item: PaymentsPreprocessingResponseRouterData<NexixpayRedirectionResponse>,- ) -> Result<Self, Self::Error> {- let is_auto_capture = item.data.request.is_auto_capture()?;- let prev_status = item.data.status;- let (status, response) = process_nexixpay_preprocessing_response(- item.response,- item.data.request.redirect_response.as_ref(),- item.data.request.metadata.clone(),- is_auto_capture,- item.http_code,- prev_status,- )?;-- Ok(Self {- status,- response,- ..item.data- })- }-}-impl TryFrom<PaymentsPostAuthenticateResponseRouterData<NexixpayRedirectionResponse>>for PaymentsPostAuthenticateRouterData{diff --git a/crates/hyperswitch_connectors/src/connectors/nmi.rs b/crates/hyperswitch_connectors/src/connectors/nmi.rsindex 4458531629..5d8efa4f9d 100644--- a/crates/hyperswitch_connectors/src/connectors/nmi.rs+++ b/crates/hyperswitch_connectors/src/connectors/nmi.rs@@ -15,14 +15,13 @@ use hyperswitch_domain_models::{router_data::{AccessToken, ErrorResponse, RouterData},router_flow_types::{unified_authentication_service::PreAuthenticate, AccessTokenAuth, Authorize, Capture,- CompleteAuthorize, Execute, PSync, PaymentMethodToken, PreProcessing, RSync, Session,- SetupMandate, Void,+ CompleteAuthorize, Execute, PSync, PaymentMethodToken, RSync, Session, SetupMandate, Void,},router_request_types::{AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData,PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,- PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsSessionData,- PaymentsSyncData, RefundsData, SetupMandateRequestData,+ PaymentsPreAuthenticateData, PaymentsSessionData, PaymentsSyncData, RefundsData,+ SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -31,8 +30,7 @@ use hyperswitch_domain_models::{types::{PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,PaymentsCompleteAuthorizeRouterData, PaymentsPreAuthenticateRouterData,- PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundsRouterData,- SetupMandateRouterData,+ PaymentsSyncRouterData, RefundsRouterData, SetupMandateRouterData,},};use hyperswitch_interfaces::{@@ -46,8 +44,8 @@ use hyperswitch_interfaces::{events::connector_api_logs::ConnectorEvent,types::{PaymentsAuthorizeType, PaymentsCaptureType, PaymentsCompleteAuthorizeType,- PaymentsPreAuthenticateType, PaymentsPreProcessingType, PaymentsSyncType, PaymentsVoidType,- RefundExecuteType, RefundSyncType, Response, SetupMandateType,+ PaymentsPreAuthenticateType, PaymentsSyncType, PaymentsVoidType, RefundExecuteType,+ RefundSyncType, Response, SetupMandateType,},webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},};@@ -352,85 +350,6 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons}}-impl api::PaymentsPreProcessing for Nmi {}--impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData> for Nmi {- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> {- self.build_headers(req, connectors)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- _req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, ConnectorError> {- Ok(format!("{}api/transact.php", self.base_url(connectors)))- }-- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, ConnectorError> {- let connector_req = nmi::NmiVaultRequest::try_from(req)?;- Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, ConnectorError> {- let req = Some(- RequestBuilder::new()- .method(Method::Post)- .attach_default_headers()- .headers(PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .url(&PaymentsPreProcessingType::get_url(self, req, connectors)?)- .set_body(PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- );- Ok(req)- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, ConnectorError> {- let response: nmi::NmiVaultResponse = serde_urlencoded::from_bytes(&res.response)- .change_context(ConnectorError::ResponseDeserializationFailed)?;- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Nmi {fn get_headers(&self,diff --git a/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rsindex 5ac5d83a05..e712f2bd88 100644--- a/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs@@ -20,8 +20,7 @@ use hyperswitch_domain_models::{types::{PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,PaymentsCompleteAuthorizeRouterData, PaymentsPreAuthenticateRouterData,- PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundSyncRouterData,- RefundsRouterData, SetupMandateRouterData,+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, SetupMandateRouterData,},};use hyperswitch_interfaces::errors::ConnectorError;@@ -31,8 +30,8 @@ use serde_with::skip_serializing_none;use crate::{types::{- PaymentsPreAuthenticateResponseRouterData, PaymentsPreprocessingResponseRouterData,- PaymentsResponseRouterData, RefundsResponseRouterData, ResponseRouterData,+ PaymentsPreAuthenticateResponseRouterData, PaymentsResponseRouterData,+ RefundsResponseRouterData, ResponseRouterData,},unimplemented_payment_method,utils::{@@ -147,17 +146,6 @@ fn try_build_nmi_vault_request_from_router_data(}// Marker trait: only implemented for the allowed RouterData types-impl TryFrom<&PaymentsPreProcessingRouterData> for NmiVaultRequest {- type Error = Error;- fn try_from(item: &PaymentsPreProcessingRouterData) -> Result<Self, Self::Error> {- try_build_nmi_vault_request_from_router_data(- &item.connector_auth_type,- item.request.payment_method_data.clone(),- item.get_billing_address(),- )- }-}-impl TryFrom<&PaymentsPreAuthenticateRouterData> for NmiVaultRequest {type Error = Error;fn try_from(item: &PaymentsPreAuthenticateRouterData) -> Result<Self, Self::Error> {@@ -306,31 +294,6 @@ fn build_nmi_vault_response(Ok((response, status))}-impl TryFrom<PaymentsPreprocessingResponseRouterData<NmiVaultResponse>>- for PaymentsPreProcessingRouterData-{- type Error = Error;- fn try_from(- item: PaymentsPreprocessingResponseRouterData<NmiVaultResponse>,- ) -> Result<Self, Self::Error> {- let (response, status) = process_nmi_vault_response(- &item.data.connector_auth_type,- item.data.request.amount,- item.data.request.currency,- &item.response,- item.http_code,- item.data.connector_request_reference_id.clone(),- item.data.status,- )?;-- Ok(Self {- status,- response,- ..item.data- })- }-}-impl TryFrom<PaymentsPreAuthenticateResponseRouterData<NmiVaultResponse>>for PaymentsPreAuthenticateRouterData{diff --git a/crates/hyperswitch_connectors/src/connectors/nordea.rs b/crates/hyperswitch_connectors/src/connectors/nordea.rsindex effaa46123..cad85e4c2c 100644--- a/crates/hyperswitch_connectors/src/connectors/nordea.rs+++ b/crates/hyperswitch_connectors/src/connectors/nordea.rs@@ -19,13 +19,13 @@ use hyperswitch_domain_models::{access_token_auth::AccessTokenAuth,payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},refunds::{Execute, RSync},- AccessTokenAuthentication, CreateOrder, PreProcessing,+ AccessTokenAuthentication, CreateOrder,},router_request_types::{AccessTokenAuthenticationRequestData, AccessTokenRequestData, CreateOrderRequestData,PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,- PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData, PaymentsSyncData,- RefundsData, SetupMandateRequestData,+ PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, RefundsData,+ SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -33,8 +33,7 @@ use hyperswitch_domain_models::{},types::{AccessTokenAuthenticationRouterData, CreateOrderRouterData, PaymentsAuthorizeRouterData,- PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefreshTokenRouterData,- RefundsRouterData,+ PaymentsSyncRouterData, RefreshTokenRouterData, RefundsRouterData,},};use hyperswitch_interfaces::{@@ -252,7 +251,6 @@ impl api::Refund for Nordea {}impl api::RefundExecute for Nordea {}impl api::RefundSync for Nordea {}impl api::PaymentToken for Nordea {}-impl api::PaymentsPreProcessing for Nordea {}impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>for Nordea@@ -858,134 +856,6 @@ impl ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseD}}-impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Nordea-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError>- {- self.build_headers(req, connectors)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- // Determine the payment endpoint based on country and currency- let country = req.get_billing_country()?;-- let currency =- req.request- .currency- .ok_or(errors::ConnectorError::MissingRequiredField {- field_name: "currency".into(),- })?;-- let endpoint = match (country, currency) {- (api_models::enums::CountryAlpha2::FI, api_models::enums::Currency::EUR) => {- "/personal/v5/payments/sepa-credit-transfers"- }- (api_models::enums::CountryAlpha2::DK, api_models::enums::Currency::DKK) => {- "/personal/v5/payments/domestic-credit-transfers"- }- (- api_models::enums::CountryAlpha2::FI- | api_models::enums::CountryAlpha2::DK- | api_models::enums::CountryAlpha2::SE- | api_models::enums::CountryAlpha2::NO,- _,- ) => "/personal/v5/payments/cross-border-credit-transfers",- _ => {- return Err(errors::ConnectorError::NotSupported {- message: format!("Country {country:?} is not supported by Nordea"),- connector: "Nordea",- }- .into())- }- };-- Ok(format!("{}{}", self.base_url(connectors), endpoint))- }-- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let minor_amount = req.request.minor_amount;- let currency =- req.request- .currency- .ok_or(errors::ConnectorError::MissingRequiredField {- field_name: "currency".into(),- })?;-- let amount = utils::convert_amount(self.amount_converter, minor_amount, currency)?;- let connector_router_data = NordeaRouterData::from((amount, req));- let connector_req = NordeaPaymentsRequest::try_from(&connector_router_data)?;- Ok(RequestContent::Json(Box::new(connector_req)))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Post)- .url(&types::PaymentsPreProcessingType::get_url(- self, req, connectors,- )?)- .attach_default_headers()- .headers(types::PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .set_body(types::PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: NordeaPaymentsInitiateResponse = res- .response- .parse_struct("NordeaPaymentsInitiateResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);-- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Nordea {fn get_headers(&self,diff --git a/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rsindex 20b920afa7..a8d81275cd 100644--- a/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs@@ -5,12 +5,12 @@ use error_stack::ResultExt;use hyperswitch_domain_models::{payment_method_data::{BankDebitData, PaymentMethodData},router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},- router_flow_types::{Authorize, PreProcessing},- router_request_types::{PaymentsAuthorizeData, PaymentsPreProcessingData, ResponseId},+ router_flow_types::Authorize,+ router_request_types::{PaymentsAuthorizeData, ResponseId},router_response_types::{PaymentsResponseData, RedirectForm},types::{self, AccessTokenAuthenticationRouterData, CreateOrderRouterData,- PaymentsAuthorizeRouterData, PaymentsPreProcessingRouterData, PaymentsSyncRouterData,+ PaymentsAuthorizeRouterData, PaymentsSyncRouterData,},};use hyperswitch_interfaces::errors;@@ -29,10 +29,7 @@ use crate::{NordeaPaymentsConfirmResponse, NordeaPaymentsInitiateResponse,},},- types::{- CreateOrderResponseRouterData, PaymentsPreprocessingResponseRouterData,- PaymentsSyncResponseRouterData, ResponseRouterData,- },+ types::{CreateOrderResponseRouterData, PaymentsSyncResponseRouterData, ResponseRouterData},utils::{self, get_unimplemented_payment_method_error_message, RouterData as _},};@@ -217,42 +214,6 @@ impl<'de> Deserialize<'de> for PaymentsUrgency {}}-fn get_creditor_account_from_metadata(- router_data: &PaymentsPreProcessingRouterData,-) -> Result<CreditorAccount, Error> {- let metadata: NordeaConnectorMetadataObject =- utils::to_connector_meta_from_secret(router_data.connector_meta_data.clone())- .change_context(errors::ConnectorError::InvalidConnectorConfig {- config: "merchant_connector_account.metadata",- })?;- let creditor_account = CreditorAccount {- account: AccountNumber {- account_type: AccountType::try_from(metadata.account_type.as_str())- .unwrap_or(AccountType::Iban),- currency: router_data.request.currency,- value: metadata.destination_account_number,- },- country: router_data.get_optional_billing_country(),- // Merchant is the beneficiary in this case- name: Some(metadata.merchant_name),- message: router_data- .description- .as_ref()- .map(|desc| desc.chars().take(20).collect::<String>()),- bank: Some(CreditorBank {- address: None,- bank_code: None,- bank_name: None,- business_identifier_code: None,- country: router_data.get_billing_country()?,- }),- creditor_address: None,- // Either Reference or Message must be supplied in the request- reference: None,- };- Ok(creditor_account)-}-fn get_creditor_account_from_metadata_for_create_order(router_data: &CreateOrderRouterData,) -> Result<CreditorAccount, Error> {@@ -371,93 +332,6 @@ impl TryFrom<&NordeaRouterData<&CreateOrderRouterData>> for NordeaPaymentsReques}}-impl TryFrom<&NordeaRouterData<&PaymentsPreProcessingRouterData>> for NordeaPaymentsRequest {- type Error = Error;- fn try_from(- item: &NordeaRouterData<&PaymentsPreProcessingRouterData>,- ) -> Result<Self, Self::Error> {- match item.router_data.request.payment_method_data.clone() {- Some(PaymentMethodData::BankDebit(bank_debit_data)) => match bank_debit_data {- BankDebitData::SepaBankDebit { iban, .. } => {- let creditor_account = get_creditor_account_from_metadata(item.router_data)?;- let debitor_account = DebitorAccount {- account: AccountNumber {- account_type: AccountType::Iban,- currency: item.router_data.request.currency,- value: iban,- },- message: item- .router_data- .description- .as_ref()- .map(|desc| desc.chars().take(20).collect::<String>()),- };-- let instructed_amount = super::requests::InstructedAmount {- amount: item.amount.clone(),- currency: item.router_data.request.currency.ok_or(- errors::ConnectorError::MissingRequiredField {- field_name: "amount".into(),- },- )?,- };-- Ok(Self {- creditor_account,- debitor_account,- end_to_end_identification: None,- external_id: Some(item.router_data.connector_request_reference_id.clone()),- instructed_amount,- recurring: None,- request_availability_of_funds: None,- requested_execution_date: None,- tpp_messages: None,- urgency: None,- })- }- BankDebitData::AchBankDebit { .. }- | BankDebitData::BacsBankDebit { .. }- | BankDebitData::BecsBankDebit { .. }- | BankDebitData::EftDebitOrder { .. }- | BankDebitData::SepaGuarenteedBankDebit { .. } => {- Err(errors::ConnectorError::NotImplemented(- get_unimplemented_payment_method_error_message("Nordea"),- )- .into())- }- },- Some(PaymentMethodData::CardRedirect(_))- | Some(PaymentMethodData::CardDetailsForNetworkTransactionId(_))- | Some(PaymentMethodData::NetworkTokenDetailsForNetworkTransactionId(_))- | Some(- PaymentMethodData::CardWithOptionalCVC(_)- | PaymentMethodData::CardWithNetworkTokenDetails(_),- )- | Some(PaymentMethodData::CardWithLimitedDetails(_))- | Some(PaymentMethodData::DecryptedWalletTokenDetailsForNetworkTransactionId(_))- | Some(PaymentMethodData::Wallet(_))- | Some(PaymentMethodData::PayLater(_))- | Some(PaymentMethodData::BankRedirect(_))- | Some(PaymentMethodData::BankTransfer(_))- | Some(PaymentMethodData::Crypto(_))- | Some(PaymentMethodData::MandatePayment)- | Some(PaymentMethodData::Reward)- | Some(PaymentMethodData::RealTimePayment(_))- | Some(PaymentMethodData::MobilePayment(_))- | Some(PaymentMethodData::Upi(_))- | Some(PaymentMethodData::Voucher(_))- | Some(PaymentMethodData::GiftCard(_))- | Some(PaymentMethodData::OpenBanking(_))- | Some(PaymentMethodData::CardToken(_))- | Some(PaymentMethodData::NetworkToken(_))- | Some(PaymentMethodData::Card(_))- | None => {- Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into())- }- }- }-}-impl TryFrom<&NordeaRouterData<&PaymentsAuthorizeRouterData>> for NordeaPaymentsConfirmRequest {type Error = Error;fn try_from(@@ -537,22 +411,6 @@ fn convert_nordea_payment_response(Ok((response_data, status))}-impl TryFrom<PaymentsPreprocessingResponseRouterData<NordeaPaymentsInitiateResponse>>- for RouterData<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>-{- type Error = Error;- fn try_from(- item: PaymentsPreprocessingResponseRouterData<NordeaPaymentsInitiateResponse>,- ) -> Result<Self, Self::Error> {- let (response, status) = convert_nordea_payment_response(&item.response)?;- Ok(Self {- status,- response: Ok(response),- ..item.data- })- }-}-impl TryFrom<CreateOrderResponseRouterData<NordeaPaymentsInitiateResponse>>for CreateOrderRouterData{diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rsindex f776d6ff9e..aa589bace6 100644--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs+++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs@@ -28,14 +28,13 @@ use hyperswitch_domain_models::{refunds::{Execute, RSync},unified_authentication_service::PreAuthenticate,AuthorizeSessionToken, CompleteAuthorize, PostCaptureVoid, PostCaptureVoidSync,- PreProcessing,},router_request_types::{AccessTokenRequestData, AuthorizeSessionTokenData, CompleteAuthorizeData,PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,PaymentsCancelPostCaptureData, PaymentsCancelPostCaptureSyncData, PaymentsCaptureData,- PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsSessionData,- PaymentsSyncData, RefundsData, SetupMandateRequestData,+ PaymentsPreAuthenticateData, PaymentsSessionData, PaymentsSyncData, RefundsData,+ SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -45,8 +44,7 @@ use hyperswitch_domain_models::{PaymentsAuthorizeRouterData, PaymentsAuthorizeSessionTokenRouterData,PaymentsCancelPostCaptureRouterData, PaymentsCancelPostCaptureSyncRouterData,PaymentsCancelRouterData, PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,- PaymentsPreAuthenticateRouterData, PaymentsPreProcessingRouterData, PaymentsSyncRouterData,- RefundsRouterData,+ PaymentsPreAuthenticateRouterData, PaymentsSyncRouterData, RefundsRouterData,},};#[cfg(feature = "payouts")]@@ -159,7 +157,6 @@ impl api::RefundExecute for Nuvei {}impl api::RefundSync for Nuvei {}impl api::PaymentsCompleteAuthorize for Nuvei {}impl api::ConnectorAccessToken for Nuvei {}-impl api::PaymentsPreProcessing for Nuvei {}impl api::PaymentPostCaptureVoid for Nuvei {}impl api::PaymentPostCaptureVoidSync for Nuvei {}impl api::PaymentsPreAuthenticate for Nuvei {}@@ -1102,94 +1099,6 @@ impl ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, Payments}}-impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Nuvei-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError>- {- self.build_headers(req, connectors)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- _req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- Ok(format!(- "{}ppp/api/v1/initPayment.do",- ConnectorCommon::base_url(self, connectors)- ))- }-- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let connector_req =- nuvei::NuveiThreeDSInitPaymentRequest::try_from((req, req.get_session_token()?))?;- Ok(RequestContent::Json(Box::new(connector_req)))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Post)- .url(&types::PaymentsPreProcessingType::get_url(- self, req, connectors,- )?)- .attach_default_headers()- .headers(types::PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .set_body(types::PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: NuveiPaymentsResponse = res- .response- .parse_struct("NuveiPaymentsResponse")- .switch()?;- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- .change_context(errors::ConnectorError::ResponseHandlingFailed)- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Nuvei {fn get_headers(&self,diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rsindex ea87eb1c50..61bcdae91f 100644--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs@@ -60,15 +60,14 @@ use url::Url;use crate::{types::PayoutsResponseRouterData, utils::PayoutsData as _};use crate::{types::{- PaymentsPreAuthenticateResponseRouterData, PaymentsPreprocessingResponseRouterData,- RefundsResponseRouterData, ResponseRouterData,+ PaymentsPreAuthenticateResponseRouterData, RefundsResponseRouterData, ResponseRouterData,},utils::{self, convert_amount, missing_field_err, AddressData, AddressDetailsData,BrowserInformationData, CardData, ForeignTryFrom, NetworkTokenData as _,PaymentsAuthorizeRequestData, PaymentsCancelRequestData,PaymentsCompleteAuthorizeRequestData, PaymentsPreAuthenticateRequestData,- PaymentsPreProcessingRequestData, PaymentsSetupMandateRequestData, RouterData as _,+ PaymentsSetupMandateRequestData, RouterData as _,},};@@ -179,74 +178,6 @@ impl TryFrom<(&types::PaymentsPreAuthenticateRouterData, String)>}}-impl TryFrom<(&types::PaymentsPreProcessingRouterData, String)> for NuveiThreeDSInitPaymentRequest {- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- (item, session_token): (&types::PaymentsPreProcessingRouterData, String),- ) -> Result<Self, Self::Error> {- let currency = item.request.get_currency()?;- let connector_auth: NuveiAuthType = NuveiAuthType::try_from(&item.connector_auth_type)?;- let amount = item.request.get_minor_amount().to_nuvei_amount(currency)?;- let payment_method_data = item.request.get_payment_method_data()?.clone();- let card = match payment_method_data {- PaymentMethodData::Card(card) => card,- _ => Err(errors::ConnectorError::NotImplemented(- utils::get_unimplemented_payment_method_error_message("nuvei"),- ))?,- };-- let browser_info = item- .request- .browser_info- .clone()- .ok_or_else(missing_field_err("browser_info"))?;-- let return_url = match env::which() {- Env::Development => "https://example.com".to_string(),- _ => item- .request- .router_return_url- .clone()- .ok_or_else(missing_field_err("return_url"))?,- };-- let billing_address = item.get_billing().ok().map(|billing| billing.into());- let client_unique_id = get_valid_client_unique_id(- item.connector_request_reference_id.clone(),- "client_unique_id",- )?;-- Ok(Self {- session_token: session_token.into(),- merchant_id: connector_auth.merchant_id,- merchant_site_id: connector_auth.merchant_site_id,- client_request_id: item.connector_request_reference_id.clone().into(),- client_unique_id,- amount,- currency,- payment_option: CardPaymentOption {- card: Card {- card_number: Some(card.card_number),- card_holder_name: item.get_optional_billing_full_name(),- expiration_month: Some(card.card_exp_month),- expiration_year: Some(card.card_exp_year),- cvv: Some(card.card_cvc),- ..Default::default()- },- },- device_details: DeviceDetails {- ip_address: browser_info.get_ip_address()?,- },- user_token_id: item.customer_id.clone(),- billing_address,- url_details: UrlDetails {- success_url: return_url.clone(),- failure_url: return_url.clone(),- pending_url: return_url,- },- })- }-}#[derive(Debug, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct NuveiSessionRequest {@@ -2928,38 +2859,6 @@ impl TryFrom<PaymentsPreAuthenticateResponseRouterData<NuveiPaymentsResponse>>}}-impl TryFrom<PaymentsPreprocessingResponseRouterData<NuveiPaymentsResponse>>- for types::PaymentsPreProcessingRouterData-{- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- item: PaymentsPreprocessingResponseRouterData<NuveiPaymentsResponse>,- ) -> Result<Self, Self::Error> {- let response = item.response;- let is_enrolled_for_3ds = response- .clone()- .payment_option- .and_then(|po| po.card)- .and_then(|c| c.three_d)- .and_then(|t| t.v2supported)- .map(to_boolean)- .unwrap_or_default();- Ok(Self {- status: get_payment_status(- Some(item.data.request.amount),- response.transaction_type,- response.transaction_status,- response.status,- ),- response: Ok(PaymentsResponseData::ThreeDSEnrollmentResponse {- enrolled_v2: is_enrolled_for_3ds,- related_transaction_id: response.transaction_id,- }),- ..item.data- })- }-}-impl From<NuveiTransactionStatus> for enums::RefundStatus {fn from(item: NuveiTransactionStatus) -> Self {match item {diff --git a/crates/hyperswitch_connectors/src/connectors/payme.rs b/crates/hyperswitch_connectors/src/connectors/payme.rsindex f3ecdae790..c75f4da754 100644--- a/crates/hyperswitch_connectors/src/connectors/payme.rs+++ b/crates/hyperswitch_connectors/src/connectors/payme.rs@@ -21,13 +21,13 @@ use hyperswitch_domain_models::{access_token_auth::AccessTokenAuth,payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},refunds::{Execute, RSync},- CompleteAuthorize, CreateOrder, InitPayment, PreProcessing,+ CompleteAuthorize, CreateOrder, InitPayment,},router_request_types::{AccessTokenRequestData, CompleteAuthorizeData, CreateOrderRequestData,PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,- PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData, PaymentsSyncData,- RefundsData, SetupMandateRequestData,+ PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, RefundsData,+ SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -35,14 +35,14 @@ use hyperswitch_domain_models::{},types::{CreateOrderRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,- PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,- PaymentsPreProcessingRouterData, RefundsRouterData, TokenizationRouterData,+ PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData, RefundsRouterData,+ TokenizationRouterData,},};use hyperswitch_interfaces::{api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,- ConnectorSpecifications, ConnectorValidation, PaymentsPreProcessing,+ ConnectorSpecifications, ConnectorValidation,},configs::Connectors,disputes::DisputePayload,@@ -50,8 +50,8 @@ use hyperswitch_interfaces::{events::connector_api_logs::ConnectorEvent,types::{CreateOrderType, PaymentsAuthorizeType, PaymentsCaptureType, PaymentsCompleteAuthorizeType,- PaymentsPreProcessingType, PaymentsSyncType, PaymentsVoidType, RefundExecuteType,- RefundSyncType, Response, TokenizationType,+ PaymentsSyncType, PaymentsVoidType, RefundExecuteType, RefundSyncType, Response,+ TokenizationType,},webhooks,};@@ -60,7 +60,7 @@ use transformers as payme;use crate::{types::ResponseRouterData,- utils::{self, ForeignTryFrom, PaymentsPreProcessingRequestData},+ utils::{self, ForeignTryFrom},};#[derive(Clone)]@@ -293,8 +293,6 @@ impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, Payimpl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Payme {}-impl PaymentsPreProcessing for Payme {}-impl ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseData> for Payme {fn get_headers(&self,@@ -398,115 +396,6 @@ impl ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseD}}-impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Payme-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError>- {- self.build_headers(req, connectors)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- _req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- Ok(format!("{}api/generate-sale", self.base_url(connectors)))- }-- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let req_amount = req.request.get_minor_amount();- let req_currency = req.request.get_currency()?;- let amount = 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)))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- let req = Some(- RequestBuilder::new()- .method(Method::Post)- .attach_default_headers()- .headers(PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .url(&PaymentsPreProcessingType::get_url(self, req, connectors)?)- .set_body(PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- );- Ok(req)- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: payme::GenerateSaleResponse = res- .response- .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 = 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);-- RouterData::foreign_try_from((- ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- },- apple_pay_amount,- ))- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-- fn get_5xx_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- // we are always getting 500 in error scenarios- self.build_error_response(res, event_builder)- }-}-impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Payme {}impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Payme {diff --git a/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payme/transformers.rsindex fc2ce8a599..4aaadcdb4f 100644--- a/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs@@ -12,18 +12,15 @@ use hyperswitch_domain_models::{payment_method_data::{PaymentMethodData, WalletData},router_data::{ConnectorAuthType, ErrorResponse, PaymentMethodToken, RouterData},router_flow_types::{Execute, Void},- router_request_types::{- CreateOrderRequestData, PaymentsCancelData, PaymentsPreProcessingData, ResponseId,- },+ router_request_types::{CreateOrderRequestData, PaymentsCancelData, ResponseId},router_response_types::{MandateReference, PaymentsResponseData, PreprocessingResponseId, RedirectForm,RefundsResponseData,},types::{CreateOrderRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,- PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,- PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundSyncRouterData,- RefundsRouterData, TokenizationRouterData,+ PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData, PaymentsSyncRouterData,+ RefundSyncRouterData, RefundsRouterData, TokenizationRouterData,},};use hyperswitch_interfaces::{consts, errors};@@ -36,8 +33,8 @@ use crate::{unimplemented_payment_method,utils::{self, AddressDetailsData, CardData, PaymentsAuthorizeRequestData,- PaymentsCancelRequestData, PaymentsCompleteAuthorizeRequestData,- PaymentsPreProcessingRequestData, PaymentsSyncRequestData, RouterData as OtherRouterData,+ PaymentsCancelRequestData, PaymentsCompleteAuthorizeRequestData, PaymentsSyncRequestData,+ RouterData as OtherRouterData,},};@@ -429,43 +426,6 @@ impl TryFrom<&PaymeRouterData<&CreateOrderRouterData>> for GenerateSaleRequest {}}-impl TryFrom<&PaymeRouterData<&PaymentsPreProcessingRouterData>> for GenerateSaleRequest {- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- item: &PaymeRouterData<&PaymentsPreProcessingRouterData>,- ) -> Result<Self, Self::Error> {- let sale_type = SaleType::try_from(item.router_data)?;- let seller_payme_id =- PaymeAuthType::try_from(&item.router_data.connector_auth_type)?.seller_payme_id;- let order_details = item.router_data.request.get_order_details()?;- let services = get_services(item.router_data.auth_type);- let product_name = order_details- .first()- .ok_or_else(utils::missing_field_err("order_details"))?- .product_name- .clone();- let pmd = item- .router_data- .request- .payment_method_data- .to_owned()- .ok_or_else(utils::missing_field_err("payment_method_data"))?;- Ok(Self {- seller_payme_id,- sale_price: item.amount.to_owned(),- currency: item.router_data.request.get_currency()?,- product_name,- sale_payment_method: SalePaymentMethod::try_from(&pmd)?,- sale_type,- transaction_id: item.router_data.payment_id.clone(),- sale_return_url: item.router_data.request.get_router_return_url()?,- sale_callback_url: item.router_data.request.get_webhook_url()?,- language: LANGUAGE.to_string(),- services,- })- }-}-impl TryFrom<&PaymentMethodData> for SalePaymentMethod {type Error = error_stack::Report<errors::ConnectorError>;fn try_from(item: &PaymentMethodData) -> Result<Self, Self::Error> {@@ -580,141 +540,6 @@ impl TryFrom<&RefundSyncRouterData> for PaymeQueryTransactionRequest {}}-impl<F>- utils::ForeignTryFrom<(- ResponseRouterData<- F,- GenerateSaleResponse,- PaymentsPreProcessingData,- PaymentsResponseData,- >,- StringMajorUnit,- )> for RouterData<F, PaymentsPreProcessingData, PaymentsResponseData>-{- type Error = error_stack::Report<errors::ConnectorError>;- fn foreign_try_from(- (item, apple_pay_amount): (- ResponseRouterData<- F,- GenerateSaleResponse,- PaymentsPreProcessingData,- PaymentsResponseData,- >,- StringMajorUnit,- ),- ) -> Result<Self, Self::Error> {- match item.data.payment_method {- PaymentMethod::Card => {- match item.data.auth_type {- AuthenticationType::NoThreeDs => {- Ok(Self {- // We don't get any status from payme, so defaulting it to pending- // then move to authorize flow- status: enums::AttemptStatus::Pending,- preprocessing_id: Some(item.response.payme_sale_id.to_owned()),- response: Ok(PaymentsResponseData::PreProcessingResponse {- pre_processing_id: PreprocessingResponseId::ConnectorTransactionId(- item.response.payme_sale_id,- ),- connector_metadata: None,- session_token: None,- connector_response_reference_id: None,- }),- ..item.data- })- }- AuthenticationType::ThreeDs => Ok(Self {- // We don't go to authorize flow in 3ds,- // Response is send directly after preprocessing flow- // redirection data is send to run script along- // status is made authentication_pending to show redirection- status: enums::AttemptStatus::AuthenticationPending,- preprocessing_id: Some(item.response.payme_sale_id.to_owned()),- response: Ok(PaymentsResponseData::TransactionResponse {- resource_id: ResponseId::ConnectorTransactionId(- item.response.payme_sale_id.to_owned(),- ),- redirection_data: Box::new(Some(RedirectForm::Payme)),- mandate_reference: Box::new(None),- connector_metadata: None,- network_txn_id: None,- network_txn_link_id: None,- connector_response_reference_id: None,- incremental_authorization_allowed: None,- authentication_data: None,- charges: None,- payment_account_reference: None,- }),- ..item.data- }),- }- }- _ => {- let currency_code = item.data.request.get_currency()?;- let pmd = item.data.request.payment_method_data.to_owned();- let payme_auth_type = PaymeAuthType::try_from(&item.data.connector_auth_type)?;-- let session_token = match pmd {- Some(PaymentMethodData::Wallet(WalletData::ApplePayThirdPartySdk(- _,- ))) => Some(api_models::payments::SessionToken::ApplePay(Box::new(- api_models::payments::ApplepaySessionTokenResponse {- session_token_data: Some(- api_models::payments::ApplePaySessionResponse::NoSessionResponse(api_models::payments::NullObject),- ),- payment_request_data: Some(- api_models::payments::ApplePayPaymentRequest {- country_code: item.data.get_billing_country()?,- currency_code,- total: api_models::payments::AmountInfo {- label: "Apple Pay".to_string(),- total_type: None,- amount: apple_pay_amount,- },- merchant_capabilities: None,- supported_networks: None,- merchant_identifier: None,- required_billing_contact_fields: None,- required_shipping_contact_fields: None,- recurring_payment_request: None,- },- ),- connector: "payme".to_string(),- delayed_session_token: true,- sdk_next_action: api_models::payments::SdkNextAction {- next_action: api_models::payments::NextActionCall::Sync,- should_block_confirm: None,-},- connector_reference_id: Some(item.response.payme_sale_id.to_owned()),- connector_sdk_public_key: Some(- payme_auth_type.payme_public_key.expose(),- ),- connector_merchant_id: payme_auth_type- .payme_merchant_id- .map(|mid| mid.expose()),- },- ))),- _ => None,- };- Ok(Self {- // We don't get any status from payme, so defaulting it to pending- status: enums::AttemptStatus::Pending,- preprocessing_id: Some(item.response.payme_sale_id.to_owned()),- response: Ok(PaymentsResponseData::PreProcessingResponse {- pre_processing_id: PreprocessingResponseId::ConnectorTransactionId(- item.response.payme_sale_id,- ),- connector_metadata: None,- session_token,- connector_response_reference_id: None,- }),- ..item.data- })- }- }- }-}-impl<F>utils::ForeignTryFrom<(ResponseRouterData<F, GenerateSaleResponse, CreateOrderRequestData, PaymentsResponseData>,@@ -1100,23 +925,6 @@ impl TryFrom<&CreateOrderRouterData> for SaleType {}}-impl TryFrom<&PaymentsPreProcessingRouterData> for SaleType {- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(value: &PaymentsPreProcessingRouterData) -> Result<Self, Self::Error> {- let sale_type = if value.request.setup_mandate_details.is_some() {- // First mandate- Self::Token- } else {- // Normal payments- match value.request.is_auto_capture()? {- true => Self::Sale,- false => Self::Authorize,- }- };- Ok(sale_type)- }-}-#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, strum::Display)]#[serde(rename_all = "kebab-case")]pub enum SaleStatus {diff --git a/crates/hyperswitch_connectors/src/connectors/paypal.rs b/crates/hyperswitch_connectors/src/connectors/paypal.rsindex 06f0be1350..609ebaa590 100644--- a/crates/hyperswitch_connectors/src/connectors/paypal.rs+++ b/crates/hyperswitch_connectors/src/connectors/paypal.rs@@ -21,8 +21,7 @@ use hyperswitch_domain_models::{access_token_auth::AccessTokenAuth,payments::{Authorize, Capture, ExtendAuthorization, IncrementalAuthorization, PSync,- PaymentMethodToken, PostSessionTokens, PreProcessing, SdkSessionUpdate, Session,- SetupMandate, Void,+ PaymentMethodToken, PostSessionTokens, SdkSessionUpdate, Session, SetupMandate, Void,},refunds::{Execute, RSync},unified_authentication_service::PostAuthenticate,@@ -32,9 +31,9 @@ use hyperswitch_domain_models::{AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData,PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,- PaymentsPostAuthenticateData, PaymentsPostSessionTokensData, PaymentsPreProcessingData,- PaymentsSessionData, PaymentsSyncData, RefundsData, SdkPaymentsSessionUpdateData,- SetupMandateRequestData, VerifyWebhookSourceRequestData,+ PaymentsPostAuthenticateData, PaymentsPostSessionTokensData, PaymentsSessionData,+ PaymentsSyncData, RefundsData, SdkPaymentsSessionUpdateData, SetupMandateRequestData,+ VerifyWebhookSourceRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -44,10 +43,9 @@ use hyperswitch_domain_models::{PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,PaymentsCompleteAuthorizeRouterData, PaymentsExtendAuthorizationRouterData,PaymentsIncrementalAuthorizationRouterData, PaymentsPostAuthenticateRouterData,- PaymentsPostSessionTokensRouterData, PaymentsPreProcessingRouterData,- PaymentsSessionRouterData, PaymentsSyncRouterData, RefreshTokenRouterData,- RefundSyncRouterData, RefundsRouterData, SdkSessionUpdateRouterData,- SetupMandateRouterData, VerifyWebhookSourceRouterData,+ PaymentsPostSessionTokensRouterData, PaymentsSessionRouterData, PaymentsSyncRouterData,+ RefreshTokenRouterData, RefundSyncRouterData, RefundsRouterData,+ SdkSessionUpdateRouterData, SetupMandateRouterData, VerifyWebhookSourceRouterData,},};#[cfg(feature = "payouts")]@@ -70,9 +68,9 @@ use hyperswitch_interfaces::{types::{ExtendedAuthorizationType, IncrementalAuthorizationType, PaymentsAuthorizeType,PaymentsCaptureType, PaymentsCompleteAuthorizeType, PaymentsPostAuthenticateType,- PaymentsPostSessionTokensType, PaymentsPreProcessingType, PaymentsSessionType,- PaymentsSyncType, PaymentsVoidType, RefreshTokenType, RefundExecuteType, RefundSyncType,- Response, SdkSessionUpdateType, SetupMandateType, VerifyWebhookSourceType,+ PaymentsPostSessionTokensType, PaymentsSessionType, PaymentsSyncType, PaymentsVoidType,+ RefreshTokenType, RefundExecuteType, RefundSyncType, Response, SdkSessionUpdateType,+ SetupMandateType, VerifyWebhookSourceType,},webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},};@@ -1544,92 +1542,6 @@ impl}}-impl api::PaymentsPreProcessing for Paypal {}--impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Paypal-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {- self.build_headers(req, connectors)- }-- fn get_url(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- let order_id = req- .request- .connector_transaction_id- .to_owned()- .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?;- Ok(format!(- "{}v2/checkout/orders/{}?fields=payment_source",- self.base_url(connectors),- order_id,- ))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Get)- .url(&PaymentsPreProcessingType::get_url(self, req, connectors)?)- .attach_default_headers()- .headers(PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: paypal::PaypalPreProcessingResponse = res- .response- .parse_struct("paypal PaypalPreProcessingResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);-- let (status, response) = match PaymentsResponseData::try_from(response) {- Ok(data) => (enums::AttemptStatus::AuthenticationSuccessful, Ok(data)),- Err(error) => {- let mut error: ErrorResponse = error;- error.status_code = res.status_code;- (enums::AttemptStatus::Failure, Err(error))- }- };-- Ok(PaymentsPreProcessingRouterData {- status,- response,- ..data.clone()- })- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl api::PaymentsPostAuthenticate for Paypal {}impl ConnectorIntegration<PostAuthenticate, PaymentsPostAuthenticateData, PaymentsResponseData>diff --git a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rsindex 347998bc80..3a345aeba4 100644--- a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs@@ -2171,28 +2171,6 @@ pub struct PaypalThreeDsResponse {links: Vec<PaypalLinks>,}-#[derive(Debug, Clone, Serialize, Deserialize)]-#[serde(untagged)]-pub enum PaypalPreProcessingResponse {- PaypalLiabilityResponse(PaypalLiabilityResponse),- PaypalNonLiabilityResponse(PaypalNonLiabilityResponse),-}--impl TryFrom<PaypalPreProcessingResponse> for PaymentsResponseData {- type Error = ErrorResponse;-- fn try_from(response: PaypalPreProcessingResponse) -> Result<Self, Self::Error> {- match response {- PaypalPreProcessingResponse::PaypalNonLiabilityResponse(_) => {- Ok(auth_success_response())- }- PaypalPreProcessingResponse::PaypalLiabilityResponse(liability_response) => {- validate_liability_response(liability_response).map_err(|e| *e)- }- }- }-}-fn auth_success_response() -> PaymentsResponseData {PaymentsResponseData::TransactionResponse {resource_id: ResponseId::NoResponseId,diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe.rs b/crates/hyperswitch_connectors/src/connectors/paysafe.rsindex bf11c888fd..070b62e7f4 100644--- a/crates/hyperswitch_connectors/src/connectors/paysafe.rs+++ b/crates/hyperswitch_connectors/src/connectors/paysafe.rs@@ -21,13 +21,12 @@ use hyperswitch_domain_models::{PaymentMethodToken, Session, SetupMandate, Void,},refunds::{Execute, RSync},- PreProcessing,},router_request_types::{AccessTokenRequestData, CompleteAuthorizeData, ConnectorCustomerData,PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,- PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData, PaymentsSyncData,- RefundsData, SetupMandateRequestData,+ PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, RefundsData,+ SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -35,9 +34,8 @@ use hyperswitch_domain_models::{},types::{ConnectorCustomerRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,- PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,- PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundSyncRouterData,- RefundsRouterData, TokenizationRouterData,+ PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData, PaymentsSyncRouterData,+ RefundSyncRouterData, RefundsRouterData, TokenizationRouterData,},};use hyperswitch_interfaces::{@@ -59,8 +57,7 @@ use crate::{types::ResponseRouterData,utils::{self, PaymentMethodTokenizationRequestData, PaymentsAuthorizeRequestData,- PaymentsPreProcessingRequestData, PaymentsSyncRequestData,- RefundsRequestData as OtherRefundsRequestData, RouterData as _,+ PaymentsSyncRequestData, RefundsRequestData as OtherRefundsRequestData, RouterData as _,},};@@ -104,110 +101,6 @@ impl api::RefundExecute for Paysafe {}impl api::RefundSync for Paysafe {}impl api::PaymentToken for Paysafe {}impl api::ConnectorCustomer for Paysafe {}-impl api::PaymentsPreProcessing for Paysafe {}--impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Paysafe-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError>- {- self.build_headers(req, connectors)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- let base_url = self.base_url(connectors);- if req.request.is_customer_initiated_mandate_payment() {- let customer_id = req.get_connector_customer_id()?.to_string();- Ok(format!(- "{base_url}v1/customers/{customer_id}/paymenthandles"- ))- } else {- Ok(format!("{}v1/paymenthandles", self.base_url(connectors)))- }- }-- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let minor_amount = req.request.minor_amount;- let currency =- req.request- .currency- .ok_or(errors::ConnectorError::MissingRequiredField {- field_name: "currency".into(),- })?;- let amount = utils::convert_amount(self.amount_converter, minor_amount, currency)?;-- let connector_router_data = paysafe::PaysafeRouterData::from((amount, req));- let connector_req = paysafe::PaysafePaymentHandleRequest::try_from(&connector_router_data)?;- Ok(RequestContent::Json(Box::new(connector_req)))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Post)- .url(&types::PaymentsPreProcessingType::get_url(- self, req, connectors,- )?)- .attach_default_headers()- .headers(types::PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .set_body(types::PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: paysafe::PaysafePaymentHandleResponse = res- .response- .parse_struct("PaysafePaymentHandleResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);-- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>for Paysafediff --git a/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rsindex 3c1b890960..c33c17b1d9 100644--- a/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs@@ -27,8 +27,8 @@ use hyperswitch_domain_models::{},types::{ConnectorCustomerRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,- PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,- PaymentsPreProcessingRouterData, RefundsRouterData, TokenizationRouterData,+ PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData, RefundsRouterData,+ TokenizationRouterData,},};use hyperswitch_interfaces::{consts, errors};@@ -36,15 +36,11 @@ use hyperswitch_masking::{ExposeInterface, PeekInterface, Secret};use serde::{Deserialize, Serialize};use crate::{- types::{- PaymentsPreprocessingResponseRouterData, PaymentsResponseRouterData,- RefundsResponseRouterData, ResponseRouterData,- },+ types::{PaymentsResponseRouterData, RefundsResponseRouterData, ResponseRouterData},utils::{- self, missing_field_err, to_connector_meta, BrowserInformationData, CardData,+ self, to_connector_meta, BrowserInformationData, CardData,PaymentMethodTokenizationRequestData, PaymentsAuthorizeRequestData,- PaymentsCompleteAuthorizeRequestData, PaymentsPreProcessingRequestData,- RouterData as RouterDataUtils,+ PaymentsCompleteAuthorizeRequestData, RouterData as RouterDataUtils,},};@@ -561,166 +557,6 @@ where}}-impl TryFrom<&PaysafeRouterData<&PaymentsPreProcessingRouterData>> for PaysafePaymentHandleRequest {- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- item: &PaysafeRouterData<&PaymentsPreProcessingRouterData>,- ) -> Result<Self, Self::Error> {- let metadata: PaysafeConnectorMetadataObject =- utils::to_connector_meta_from_secret(item.router_data.connector_meta_data.clone())- .change_context(errors::ConnectorError::InvalidConnectorConfig {- config: "merchant_connector_account.metadata",- })?;-- let amount = item.amount;- let currency_code = item.router_data.request.get_currency()?;- let redirect_url = item.router_data.request.get_router_return_url()?;- let return_links = vec![- ReturnLink {- rel: LinkType::Default,- href: redirect_url.clone(),- method: Method::Get.to_string(),- },- ReturnLink {- rel: LinkType::OnCompleted,- href: redirect_url.clone(),- method: Method::Get.to_string(),- },- ReturnLink {- rel: LinkType::OnFailed,- href: redirect_url.clone(),- method: Method::Get.to_string(),- },- ReturnLink {- rel: LinkType::OnCancelled,- href: redirect_url.clone(),- method: Method::Get.to_string(),- },- ];- let settle_with_auth = matches!(- item.router_data.request.capture_method,- Some(enums::CaptureMethod::Automatic) | None- );- let transaction_type = TransactionType::Payment;-- let billing_details = create_paysafe_billing_details(- item.router_data- .request- .is_customer_initiated_mandate_payment(),- item.router_data,- )?;-- let (payment_method, payment_type, account_id) =- match item.router_data.request.get_payment_method_data()?.clone() {- PaymentMethodData::Card(req_card) => {- let card = PaysafeCard {- card_num: req_card.card_number.clone(),- card_expiry: PaysafeCardExpiry {- month: req_card.card_exp_month.clone(),- year: req_card.get_expiry_year_4_digit(),- },- cvv: if req_card.card_cvc.clone().expose().is_empty() {- None- } else {- Some(req_card.card_cvc.clone())- },- holder_name: item.router_data.get_optional_billing_full_name(),- };-- let payment_method = PaysafePaymentMethod::Card { card: card.clone() };- let payment_type = PaysafePaymentType::Card;- let account_id = metadata- .account_id- .get_no_three_ds_account_id(currency_code)?;- (payment_method, payment_type, account_id)- }- PaymentMethodData::Wallet(wallet_data) => match wallet_data {- WalletData::ApplePay(applepay_data) => {- let is_encrypted = matches!(- applepay_data.payment_data,- ApplePayPaymentData::Encrypted(_)- );-- let account_id = if is_encrypted {- metadata- .account_id- .get_applepay_encrypt_account_id(currency_code)?- } else {- metadata- .account_id- .get_applepay_decrypt_account_id(currency_code)?- };-- let applepay_payment =- PaysafeApplepayPayment::try_from((&applepay_data, item))?;-- let payment_method = PaysafePaymentMethod::ApplePay {- apple_pay: Box::new(applepay_payment),- };-- let payment_type = PaysafePaymentType::Card;-- (payment_method, payment_type, account_id)- }- WalletData::AliPayQr(_)- | WalletData::AliPayRedirect(_)- | WalletData::AliPayHkRedirect(_)- | WalletData::AmazonPay(_)- | WalletData::AmazonPayRedirect(_)- | WalletData::Paysera(_)- | WalletData::Skrill(_)- | WalletData::Neteller(_)- | WalletData::BluecodeRedirect {}- | WalletData::MomoRedirect(_)- | WalletData::KakaoPayRedirect(_)- | WalletData::GoPayRedirect(_)- | WalletData::GcashRedirect(_)- | WalletData::ApplePayRedirect(_)- | WalletData::ApplePayThirdPartySdk(_)- | WalletData::DanaRedirect {}- | WalletData::GooglePayRedirect(_)- | WalletData::GooglePay(_)- | WalletData::GooglePayThirdPartySdk(_)- | WalletData::MbWayRedirect(_)- | WalletData::MobilePayRedirect(_)- | WalletData::PaypalSdk(_)- | WalletData::PaypalRedirect(_)- | WalletData::Paze(_)- | WalletData::SamsungPay(_)- | WalletData::TwintRedirect {}- | WalletData::VippsRedirect {}- | WalletData::TouchNGoRedirect(_)- | WalletData::WeChatPayRedirect(_)- | WalletData::CashappQr(_)- | WalletData::SwishQr(_)- | WalletData::WeChatPayQr(_)- | WalletData::RevolutPay(_)- | WalletData::Mifinity(_) => Err(errors::ConnectorError::NotImplemented(- utils::get_unimplemented_payment_method_error_message("Paysafe"),- ))?,- },- _ => Err(errors::ConnectorError::NotImplemented(- "Payment Method".to_string(),- ))?,- };-- Ok(Self {- merchant_ref_num: item.router_data.connector_request_reference_id.clone(),- amount,- settle_with_auth,- payment_method,- currency_code,- payment_type,- transaction_type,- return_links,- account_id,- three_ds: None,- profile: None,- billing_details,- })- }-}-impl TryFrom<&PaysafeRouterData<&TokenizationRouterData>> for PaysafePaymentHandleRequest {type Error = error_stack::Report<errors::ConnectorError>;fn try_from(item: &PaysafeRouterData<&TokenizationRouterData>) -> Result<Self, Self::Error> {@@ -939,43 +775,6 @@ pub struct PaysafeMeta {pub payment_handle_token: Secret<String>,}-impl TryFrom<PaymentsPreprocessingResponseRouterData<PaysafePaymentHandleResponse>>- for PaymentsPreProcessingRouterData-{- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- item: PaymentsPreprocessingResponseRouterData<PaysafePaymentHandleResponse>,- ) -> Result<Self, Self::Error> {- Ok(Self {- status: enums::AttemptStatus::try_from(item.response.status)?,- preprocessing_id: Some(- item.response- .payment_handle_token- .to_owned()- .peek()- .to_string(),- ),- response: Ok(PaymentsResponseData::TransactionResponse {- resource_id: ResponseId::NoResponseId,- redirection_data: Box::new(None),- mandate_reference: Box::new(None),- connector_metadata: None,- network_txn_id: None,- network_txn_link_id: None,- connector_response_reference_id: None,- incremental_authorization_allowed: None,- authentication_data: None,- charges: None,- payment_account_reference: None,- }),- payment_method_token: Some(PaymentMethodToken::Token(- item.response.payment_handle_token.clone(),- )),- ..item.data- })- }-}-impl<F>TryFrom<ResponseRouterData<@@ -1177,7 +976,6 @@ struct DecryptedApplePayTokenHeader {}/// Helper function to create Apple Pay decrypted data for Paysafe-/// Used by both PaymentMethodToken and PreProcessing flowsfn get_apple_pay_decrypt_data(apple_pay_predecrypt_data: &ApplePayPredecryptData,currency: Currency,@@ -1207,113 +1005,6 @@ fn get_apple_pay_decrypt_data(})}-impl- TryFrom<(- &ApplePayWalletData,- &PaysafeRouterData<&PaymentsPreProcessingRouterData>,- )> for PaysafeApplepayPayment-{- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- (wallet_data, item): (- &ApplePayWalletData,- &PaysafeRouterData<&PaymentsPreProcessingRouterData>,- ),- ) -> Result<Self, Self::Error> {- let apple_pay_payment_token = PaysafeApplePayPaymentToken {- token: PaysafeApplePayToken {- payment_data: if let Ok(PaymentMethodToken::ApplePayDecrypt(ref token)) =- item.router_data.get_payment_method_token()- {- PaysafeApplePayPaymentData::Decrypted(PaysafeApplePayDecryptedDataWrapper {- decrypted_data: get_apple_pay_decrypt_data(- token,- item.router_data- .request- .currency- .ok_or_else(missing_field_err("currency"))?,- item.amount,- )?,- })- } else {- match &wallet_data.payment_data {- ApplePayPaymentData::Decrypted(applepay_predecrypt_data) => {- PaysafeApplePayPaymentData::Decrypted(- PaysafeApplePayDecryptedDataWrapper {- decrypted_data: get_apple_pay_decrypt_data(- applepay_predecrypt_data,- item.router_data- .request- .currency- .ok_or_else(missing_field_err("currency"))?,- item.amount,- )?,- },- )- }- ApplePayPaymentData::Encrypted(applepay_encrypt_data) => {- let decoded_data = base64::prelude::BASE64_STANDARD- .decode(applepay_encrypt_data)- .change_context(errors::ConnectorError::InvalidDataFormat {- field_name: "apple_pay_encrypted_data".into(),- })?;-- let apple_pay_token: DecryptedApplePayTokenData =- serde_json::from_slice(&decoded_data).change_context(- errors::ConnectorError::InvalidDataFormat {- field_name: "apple_pay_token_json".into(),- },- )?;-- PaysafeApplePayPaymentData::Encrypted(PaysafeApplePayEncryptedData {- data: apple_pay_token.data,- signature: apple_pay_token.signature,- header: PaysafeApplePayHeader {- public_key_hash: apple_pay_token.header.public_key_hash,- ephemeral_public_key: apple_pay_token- .header- .ephemeral_public_key,- transaction_id: apple_pay_token.header.transaction_id,- },- version: apple_pay_token.version,- })- }- }- },- payment_method: PaysafeApplePayPaymentMethod {- display_name: Secret::new(wallet_data.payment_method.display_name.clone()),- network: Secret::new(wallet_data.payment_method.network.clone()),- method_type: Secret::new(wallet_data.payment_method.pm_type.clone()),- },- transaction_identifier: wallet_data.transaction_identifier.clone(),- },- billing_contact: Some(PaysafeApplePayBillingContact {- address_lines: vec![- item.router_data.get_optional_billing_line1(),- item.router_data.get_optional_billing_line2(),- ],- postal_code: item.router_data.get_billing_zip()?,- country_code: item.router_data.get_billing_country()?,- country: None,- family_name: None,- given_name: None,- locality: None,- phonetic_family_name: None,- phonetic_given_name: None,- sub_administrative_area: None,- administrative_area: None,- sub_locality: None,- }),- };-- Ok(Self {- label: None,- request_billing_address: Some(false),- apple_pay_payment_token,- })- }-}-implTryFrom<(&ApplePayWalletData,diff --git a/crates/hyperswitch_connectors/src/connectors/redsys.rs b/crates/hyperswitch_connectors/src/connectors/redsys.rsindex 7e1d12a587..6a843967af 100644--- a/crates/hyperswitch_connectors/src/connectors/redsys.rs+++ b/crates/hyperswitch_connectors/src/connectors/redsys.rs@@ -16,13 +16,13 @@ use hyperswitch_domain_models::{payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},refunds::{Execute, RSync},unified_authentication_service::{Authenticate, PreAuthenticate},- CompleteAuthorize, PreProcessing,+ CompleteAuthorize,},router_request_types::{AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData,PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,- PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsSessionData,- PaymentsSyncData, RefundsData, SetupMandateRequestData,+ PaymentsPreAuthenticateData, PaymentsSessionData, PaymentsSyncData, RefundsData,+ SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -31,8 +31,8 @@ use hyperswitch_domain_models::{types::{PaymentsAuthenticateRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,- PaymentsPreAuthenticateRouterData, PaymentsPreProcessingRouterData, PaymentsSyncRouterData,- RefundExecuteRouterData, RefundSyncRouterData,+ PaymentsPreAuthenticateRouterData, PaymentsSyncRouterData, RefundExecuteRouterData,+ RefundSyncRouterData,},};use hyperswitch_interfaces::{@@ -45,8 +45,8 @@ use hyperswitch_interfaces::{events::connector_api_logs::ConnectorEvent,types::{PaymentsAuthenticateType, PaymentsAuthorizeType, PaymentsCaptureType,- PaymentsCompleteAuthorizeType, PaymentsPreAuthenticateType, PaymentsPreProcessingType,- PaymentsSyncType, PaymentsVoidType, RefundExecuteType, RefundSyncType, Response,+ PaymentsCompleteAuthorizeType, PaymentsPreAuthenticateType, PaymentsSyncType,+ PaymentsVoidType, RefundExecuteType, RefundSyncType, Response,},webhooks,};@@ -86,7 +86,6 @@ impl api::Refund for Redsys {}impl api::RefundExecute for Redsys {}impl api::RefundSync for Redsys {}impl api::PaymentToken for Redsys {}-impl api::PaymentsPreProcessing for Redsys {}impl api::PaymentsPreAuthenticate for Redsys {}impl api::PaymentsAuthenticate for Redsys {}impl api::PaymentsCompleteAuthorize for Redsys {}@@ -208,86 +207,6 @@ where}}-impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Redsys-{- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }- fn get_url(- &self,- _req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- Ok(format!(- "{}/sis/rest/iniciaPeticionREST",- self.base_url(connectors)- ))- }- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let minor_amount = req.request.minor_amount;- let currency =- req.request- .currency- .ok_or(errors::ConnectorError::MissingRequiredField {- field_name: "currency".into(),- })?;-- let amount =- connector_utils::convert_amount(self.amount_converter, minor_amount, currency)?;- let connector_router_data = redsys::RedsysRouterData::from((amount, req, currency));- let connector_req = redsys::RedsysTransaction::try_from(&connector_router_data)?;- Ok(RequestContent::Json(Box::new(connector_req)))- }- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Post)- .url(&PaymentsPreProcessingType::get_url(self, req, connectors)?)- .attach_default_headers()- .set_body(PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: redsys::RedsysResponse = res- .response- .parse_struct("RedsysResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>for Redsys{diff --git a/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs b/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rsindex a77f32770d..e6a0a393f1 100644--- a/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs@@ -22,8 +22,8 @@ use hyperswitch_domain_models::{types::{PaymentsAuthenticateRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,- PaymentsPreAuthenticateRouterData, PaymentsPreProcessingRouterData, PaymentsSyncRouterData,- RefundSyncRouterData, RefundsRouterData,+ PaymentsPreAuthenticateRouterData, PaymentsSyncRouterData, RefundSyncRouterData,+ RefundsRouterData,},};use hyperswitch_interfaces::errors;@@ -33,14 +33,12 @@ use serde::{Deserialize, Serialize};use crate::{types::{PaymentsCancelResponseRouterData, PaymentsCaptureResponseRouterData,- PaymentsPreAuthenticateResponseRouterData, PaymentsPreprocessingResponseRouterData,- RefundsResponseRouterData, ResponseRouterData,+ PaymentsPreAuthenticateResponseRouterData, RefundsResponseRouterData, ResponseRouterData,},utils::{self as connector_utils, missing_field_err, AddressDetailsData, BrowserInformationData,CardData, ForeignTryFrom, PaymentsAuthenticateRequestData, PaymentsAuthorizeRequestData,- PaymentsCompleteAuthorizeRequestData, PaymentsPreAuthenticateRequestData,- PaymentsPreProcessingRequestData, RouterData as _,+ PaymentsCompleteAuthorizeRequestData, PaymentsPreAuthenticateRequestData, RouterData as _,},};type Error = error_stack::Report<errors::ConnectorError>;@@ -574,32 +572,6 @@ fn build_3ds_transaction(params: Transaction3dsParams<'_>) -> Result<RedsysTrans}}-impl TryFrom<&RedsysRouterData<&PaymentsPreProcessingRouterData>> for RedsysTransaction {- type Error = Error;- fn try_from(- item: &RedsysRouterData<&PaymentsPreProcessingRouterData>,- ) -> Result<Self, Self::Error> {- let auth = RedsysAuthType::try_from(&item.router_data.connector_auth_type)?;- let card_data = RedsysCardData::try_from(&item.router_data.request.payment_method_data)?;- let is_auto_capture = item.router_data.request.is_auto_capture()?;-- let transaction = build_3ds_transaction(Transaction3dsParams {- auth: &auth,- is_three_ds: item.router_data.is_three_ds(),- auth_type: item.router_data.auth_type,- card_data,- amount: item.amount.clone(),- currency: item.currency,- connector_request_reference_id: &item.router_data.connector_request_reference_id,- is_auto_capture,- flow_name: "PreProcessing",- })?;-- router_env::logger::info!(connector_preprocessing_request=?transaction);- Ok(transaction)- }-}-impl TryFrom<&RedsysRouterData<&PaymentsPreAuthenticateRouterData>> for RedsysTransaction {type Error = Error;fn try_from(@@ -733,26 +705,6 @@ whereOk(response_data)}// TryFrom implementations - just extract data and call common handler-impl TryFrom<PaymentsPreprocessingResponseRouterData<RedsysResponse>>- for PaymentsPreProcessingRouterData-{- type Error = error_stack::Report<errors::ConnectorError>;-- fn try_from(- item: PaymentsPreprocessingResponseRouterData<RedsysResponse>,- ) -> Result<Self, Self::Error> {- let webhook_url = item.data.request.get_webhook_url()?;- let (status, response) =- handle_redsys_response(&item.response, item.http_code, &webhook_url)?;-- Ok(Self {- status,- response,- ..item.data- })- }-}-impl TryFrom<PaymentsPreAuthenticateResponseRouterData<RedsysResponse>>for PaymentsPreAuthenticateRouterData{diff --git a/crates/hyperswitch_connectors/src/connectors/shift4.rs b/crates/hyperswitch_connectors/src/connectors/shift4.rsindex 581b520f95..b07cee0230 100644--- a/crates/hyperswitch_connectors/src/connectors/shift4.rs+++ b/crates/hyperswitch_connectors/src/connectors/shift4.rs@@ -18,13 +18,13 @@ use hyperswitch_domain_models::{access_token_auth::AccessTokenAuth,payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},refunds::{Execute, RSync},- CompleteAuthorize, PreAuthenticate, PreProcessing,+ CompleteAuthorize, PreAuthenticate,},router_request_types::{AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData,PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,- PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsSessionData,- PaymentsSyncData, RefundsData, SetupMandateRequestData,+ PaymentsPreAuthenticateData, PaymentsSessionData, PaymentsSyncData, RefundsData,+ SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -33,8 +33,7 @@ use hyperswitch_domain_models::{types::{PaymentsAuthorizeRouterData, PaymentsCaptureRouterData,PaymentsCompleteAuthorizeRouterData, PaymentsPreAuthenticateRouterData,- PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundSyncRouterData,- RefundsRouterData,+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,},};use hyperswitch_interfaces::{@@ -172,7 +171,6 @@ impl api::Refund for Shift4 {}impl api::RefundExecute for Shift4 {}impl api::RefundSync for Shift4 {}impl api::PaymentToken for Shift4 {}-impl api::PaymentsPreProcessing for Shift4 {}impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>for Shift4@@ -573,114 +571,6 @@ impl ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, Payments}}-impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Shift4-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError>- {- let mut headers = vec![- (- headers::CONTENT_TYPE.to_string(),- "application/x-www-form-urlencoded".to_string().into(),- ),- (- ACCEPT.to_string(),- self.common_get_content_type().to_string().into(),- ),- ];- let mut api_key = self.get_auth_header(&req.connector_auth_type)?;- headers.append(&mut api_key);- Ok(headers)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- _req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- Ok(format!("{}3d-secure", self.base_url(connectors)))- }-- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let amount = convert_amount(- self.amount_converter,- req.request.minor_amount,- req.request- .currency- .ok_or_else(|| errors::ConnectorError::MissingRequiredField {- field_name: "currency".into(),- })?,- )?;- let connector_router_data = shift4::Shift4RouterData::try_from((amount, req))?;- let connector_req = Shift4PaymentsRequest::try_from(&connector_router_data)?;- Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Post)- .url(&types::PaymentsPreProcessingType::get_url(- self, req, connectors,- )?)- .attach_default_headers()- .headers(types::PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .set_body(types::PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: shift4::Shift4ThreeDsResponse = res- .response- .parse_struct("Shift4ThreeDsResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);-- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- .change_context(errors::ConnectorError::ResponseHandlingFailed)- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>for Shift4{diff --git a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rsindex 2fdbfc035b..0eef83933f 100644--- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs@@ -15,13 +15,10 @@ use hyperswitch_domain_models::{router_data::{ConnectorAuthType, RouterData},router_flow_types::refunds::{Execute, RSync},router_request_types::{- CompleteAuthorizeData, PaymentsAuthorizeData, PaymentsPreAuthenticateData,- PaymentsPreProcessingData, ResponseId,+ CompleteAuthorizeData, PaymentsAuthorizeData, PaymentsPreAuthenticateData, ResponseId,},router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData},- types::{- PaymentsPreAuthenticateRouterData, PaymentsPreProcessingRouterData, RefundsRouterData,- },+ types::{PaymentsPreAuthenticateRouterData, RefundsRouterData},};use hyperswitch_interfaces::errors;use hyperswitch_masking::Secret;@@ -30,13 +27,11 @@ use url::Url;use crate::{types::{- PaymentsPreAuthenticateResponseRouterData, PaymentsPreprocessingResponseRouterData,- RefundsResponseRouterData, ResponseRouterData,+ PaymentsPreAuthenticateResponseRouterData, RefundsResponseRouterData, ResponseRouterData,},utils::{self, to_connector_meta, PaymentsAuthorizeRequestData,- PaymentsCompleteAuthorizeRequestData, PaymentsPreAuthenticateRequestData,- PaymentsPreProcessingRequestData, RouterData as _,+ PaymentsCompleteAuthorizeRequestData, PaymentsPreAuthenticateRequestData, RouterData as _,},};@@ -142,39 +137,6 @@ impl Shift4AuthorizePreprocessingCommon for PaymentsPreAuthenticateData {}}-impl Shift4AuthorizePreprocessingCommon for PaymentsPreProcessingData {- fn get_email_optional(&self) -> Option<pii::Email> {- self.email.clone()- }-- fn get_complete_authorize_url(&self) -> Option<String> {- self.complete_authorize_url.clone()- }-- fn get_currency_required(&self) -> Result<enums::Currency, Error> {- self.get_currency()- }- fn get_payment_method_data_required(&self) -> Result<PaymentMethodData, Error> {- self.payment_method_data.clone().ok_or(- errors::ConnectorError::MissingRequiredField {- field_name: "payment_method_data".into(),- }- .into(),- )- }- fn is_automatic_capture(&self) -> Result<bool, Error> {- self.is_auto_capture()- }-- fn get_router_return_url(&self) -> Option<String> {- self.router_return_url.clone()- }- fn get_metadata(- &self,- ) -> Result<Option<serde_json::Value>, error_stack::Report<errors::ConnectorError>> {- Ok(None)- }-}#[derive(Debug, Serialize)]pub struct Shift4PaymentsRequest {amount: MinorUnit,@@ -1043,50 +1005,6 @@ impl TryFrom<PaymentsPreAuthenticateResponseRouterData<Shift4ThreeDsResponse>>}}-impl TryFrom<PaymentsPreprocessingResponseRouterData<Shift4ThreeDsResponse>>- for PaymentsPreProcessingRouterData-{- type Error = Error;- fn try_from(- item: PaymentsPreprocessingResponseRouterData<Shift4ThreeDsResponse>,- ) -> Result<Self, Self::Error> {- let redirection_data = item- .response- .redirect_url- .map(|url| RedirectForm::from((url, Method::Get)));- Ok(Self {- status: if redirection_data.is_some() {- enums::AttemptStatus::AuthenticationPending- } else {- enums::AttemptStatus::Pending- },- request: PaymentsPreProcessingData {- enrolled_for_3ds: item.response.enrolled,- ..item.data.request- },- response: Ok(PaymentsResponseData::TransactionResponse {- resource_id: ResponseId::NoResponseId,- redirection_data: Box::new(redirection_data),- mandate_reference: Box::new(None),- connector_metadata: Some(- serde_json::to_value(Shift4CardToken {- id: item.response.token.id,- })- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?,- ),- network_txn_id: None,- network_txn_link_id: None,- connector_response_reference_id: None,- incremental_authorization_allowed: None,- authentication_data: None,- charges: None,- payment_account_reference: None,- }),- ..item.data- })- }-}-impl<T, F> TryFrom<ResponseRouterData<F, Shift4NonThreeDsResponse, T, PaymentsResponseData>>for RouterData<F, T, PaymentsResponseData>{diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay.rs b/crates/hyperswitch_connectors/src/connectors/trustpay.rsindex 3eb781b63b..3b3d6ee1c8 100644--- a/crates/hyperswitch_connectors/src/connectors/trustpay.rs+++ b/crates/hyperswitch_connectors/src/connectors/trustpay.rs@@ -21,20 +21,20 @@ use hyperswitch_domain_models::{access_token_auth::AccessTokenAuth,payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},refunds::{Execute, RSync},- CreateOrder, PreProcessing,+ CreateOrder,},router_request_types::{AccessTokenRequestData, CreateOrderRequestData, PaymentMethodTokenizationData,- PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData,- PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData,+ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,+ PaymentsSyncData, RefundsData, SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,SupportedPaymentMethods, SupportedPaymentMethodsExt,},types::{- CreateOrderRouterData, PaymentsAuthorizeRouterData, PaymentsPreProcessingRouterData,- PaymentsSyncRouterData, RefreshTokenRouterData, RefundSyncRouterData, RefundsRouterData,+ CreateOrderRouterData, PaymentsAuthorizeRouterData, PaymentsSyncRouterData,+ RefreshTokenRouterData, RefundSyncRouterData, RefundsRouterData,},};use hyperswitch_interfaces::{@@ -48,8 +48,8 @@ use hyperswitch_interfaces::{errors,events::connector_api_logs::ConnectorEvent,types::{- CreateOrderType, PaymentsAuthorizeType, PaymentsPreProcessingType, PaymentsSyncType,- RefreshTokenType, RefundExecuteType, RefundSyncType, Response,+ CreateOrderType, PaymentsAuthorizeType, PaymentsSyncType, RefreshTokenType,+ RefundExecuteType, RefundSyncType, Response,},webhooks,};@@ -59,7 +59,7 @@ use transformers as trustpay;use crate::{constants::headers,types::ResponseRouterData,- utils::{self, self as connector_utils, ConnectorErrorType, PaymentsPreProcessingRequestData},+ utils::{self, self as connector_utils, ConnectorErrorType},};#[derive(Clone)]@@ -563,9 +563,7 @@ impl ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseD{let mut header = vec![(headers::CONTENT_TYPE.to_string(),- PaymentsPreProcessingType::get_content_type(self)- .to_string()- .into(),+ CreateOrderType::get_content_type(self).to_string().into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -648,108 +646,6 @@ impl ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseD}}-impl api::PaymentsPreProcessing for Trustpay {}--impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Trustpay-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError>- {- let mut header = vec![(- headers::CONTENT_TYPE.to_string(),- PaymentsPreProcessingType::get_content_type(self)- .to_string()- .into(),- )];- let mut api_key = self.get_auth_header(&req.connector_auth_type)?;- header.append(&mut api_key);- Ok(header)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- _req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- Ok(format!("{}{}", self.base_url(connectors), "api/v1/intent"))- }-- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let req_currency = req.request.get_currency()?;- let req_amount = req.request.get_minor_amount();-- let amount = 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)))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- let req = Some(- RequestBuilder::new()- .method(Method::Post)- .attach_default_headers()- .headers(PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .url(&PaymentsPreProcessingType::get_url(self, req, connectors)?)- .set_body(PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- );- Ok(req)- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: trustpay::TrustpayCreateIntentResponse = res- .response- .parse_struct("TrustpayCreateIntentResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);-- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- .change_context(errors::ConnectorError::ResponseHandlingFailed)- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl api::PaymentSession for Trustpay {}impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Trustpay {}diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rsindex 342ff18a8d..7b4a1f0006 100644--- a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs@@ -17,13 +17,13 @@ use hyperswitch_domain_models::{AccessToken, AdditionalPaymentMethodConnectorResponse, ConnectorAuthType,ConnectorResponseData, ErrorResponse, RouterData,},- router_request_types::{BrowserInformation, PaymentsPreProcessingData, ResponseId},+ router_request_types::{BrowserInformation, ResponseId},router_response_types::{PaymentsResponseData, PreprocessingResponseId, RedirectForm, RefundsResponseData,},types::{- CreateOrderRouterData, PaymentsAuthorizeRouterData, PaymentsPreProcessingRouterData,- RefreshTokenRouterData, RefundsRouterData,+ CreateOrderRouterData, PaymentsAuthorizeRouterData, RefreshTokenRouterData,+ RefundsRouterData,},};use hyperswitch_interfaces::{consts, errors};@@ -32,14 +32,10 @@ use reqwest::Url;use serde::{Deserialize, Serialize};use crate::{- types::{- CreateOrderResponseRouterData, PaymentsPreprocessingResponseRouterData,- RefundsResponseRouterData, ResponseRouterData,- },+ types::{CreateOrderResponseRouterData, RefundsResponseRouterData, ResponseRouterData},utils::{self, AddressDetailsData, BrowserInformationData, CardData, NetworkTokenData,- PaymentsAuthorizeRequestData, PaymentsPreProcessingRequestData,- RouterData as OtherRouterData,+ PaymentsAuthorizeRequestData, RouterData as OtherRouterData,},};@@ -1311,40 +1307,6 @@ impl TryFrom<&TrustpayRouterData<&CreateOrderRouterData>> for TrustpayCreateInte}}-impl TryFrom<&TrustpayRouterData<&PaymentsPreProcessingRouterData>>- for TrustpayCreateIntentRequest-{- type Error = Error;- fn try_from(- item: &TrustpayRouterData<&PaymentsPreProcessingRouterData>,- ) -> Result<Self, Self::Error> {- let is_apple_pay = item- .router_data- .request- .payment_method_type- .as_ref()- .map(|pmt| matches!(pmt, enums::PaymentMethodType::ApplePay));-- let is_google_pay = item- .router_data- .request- .payment_method_type- .as_ref()- .map(|pmt| matches!(pmt, enums::PaymentMethodType::GooglePay));-- let currency = item.router_data.request.get_currency()?;- let amount = item.amount.to_owned();-- Ok(Self {- amount,- currency: currency.to_string(),- init_apple_pay: is_apple_pay,- init_google_pay: is_google_pay,- reference: item.router_data.connector_request_reference_id.clone(),- })- }-}-#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct TrustpayCreateIntentResponse {@@ -1477,32 +1439,6 @@ impl TryFrom<CreateOrderResponseRouterData<TrustpayCreateIntentResponse>>}}-impl TryFrom<PaymentsPreprocessingResponseRouterData<TrustpayCreateIntentResponse>>- for PaymentsPreProcessingRouterData-{- type Error = Error;- fn try_from(- item: PaymentsPreprocessingResponseRouterData<TrustpayCreateIntentResponse>,- ) -> Result<Self, Self::Error> {- let create_intent_response = item.response.init_result_data.to_owned();- let secrets = item.response.secrets.to_owned();- let instance_id = item.response.instance_id.to_owned();- let pmt = PaymentsPreProcessingData::get_payment_method_type(&item.data.request)?;-- match (pmt, create_intent_response) {- (- enums::PaymentMethodType::ApplePay,- InitResultData::AppleInitResultData(apple_pay_response),- ) => get_apple_pay_session(instance_id, &secrets, apple_pay_response, item),- (- enums::PaymentMethodType::GooglePay,- InitResultData::GoogleInitResultData(google_pay_response),- ) => get_google_pay_session(instance_id, &secrets, google_pay_response, item),- _ => Err(report!(errors::ConnectorError::InvalidWallet)),- }- }-}-pub(crate) fn get_apple_pay_session<F, T>(instance_id: String,secrets: &SdkSecretInfo,diff --git a/crates/hyperswitch_connectors/src/connectors/xendit.rs b/crates/hyperswitch_connectors/src/connectors/xendit.rsindex d053f6b25f..89fc8b2f28 100644--- a/crates/hyperswitch_connectors/src/connectors/xendit.rs+++ b/crates/hyperswitch_connectors/src/connectors/xendit.rs@@ -19,16 +19,15 @@ use hyperswitch_domain_models::{router_flow_types::{access_token_auth::AccessTokenAuth,payments::{- Authorize, Capture, PSync, PaymentMethodToken, PreProcessing, Session,- SettlementSplitCreate, SetupMandate, Void,+ Authorize, Capture, PSync, PaymentMethodToken, Session, SettlementSplitCreate,+ SetupMandate, Void,},refunds::{Execute, RSync},},router_request_types::{AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,- PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData,- PaymentsSyncData, RefundsData, SettlementSplitRequestData, SetupMandateRequestData,- SplitRefundsRequest,+ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,+ RefundsData, SettlementSplitRequestData, SetupMandateRequestData, SplitRefundsRequest,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -36,8 +35,8 @@ use hyperswitch_domain_models::{},types::{PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,- PaymentsPreProcessingRouterData, PaymentsSettlementSplitCreateRouterData,- PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,+ PaymentsSettlementSplitCreateRouterData, PaymentsSyncRouterData, RefundSyncRouterData,+ RefundsRouterData,},};use hyperswitch_interfaces::{@@ -76,7 +75,6 @@ impl Xendit {}impl api::Payment for Xendit {}impl api::PaymentsSettlementSplitCreate for Xendit {}-impl api::PaymentsPreProcessing for Xendit {}impl api::PaymentSession for Xendit {}impl api::ConnectorAccessToken for Xendit {}impl api::MandateSetup for Xendit {}@@ -426,91 +424,6 @@ impl ConnectorIntegration<SettlementSplitCreate, SettlementSplitRequestData, Pay}}-impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for Xendit-{- fn get_headers(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError>- {- self.build_headers(req, connectors)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- _req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- Ok(format!("{}/split_rules", self.base_url(connectors)))- }-- fn get_request_body(- &self,- req: &PaymentsPreProcessingRouterData,- _connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- let connector_req = xendit::XenditSplitRequestData::try_from(req)?;- Ok(RequestContent::Json(Box::new(connector_req)))- }-- fn build_request(- &self,- req: &PaymentsPreProcessingRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- let req = Some(- RequestBuilder::new()- .method(Method::Post)- .attach_default_headers()- .headers(types::PaymentsPreProcessingType::get_headers(- self, req, connectors,- )?)- .url(&types::PaymentsPreProcessingType::get_url(- self, req, connectors,- )?)- .set_body(types::PaymentsPreProcessingType::get_request_body(- self, req, connectors,- )?)- .build(),- );- Ok(req)- }-- fn handle_response(- &self,- data: &PaymentsPreProcessingRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {- let response: xendit::XenditSplitResponse = res- .response- .parse_struct("XenditSplitResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;-- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}-impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Xendit {fn get_headers(&self,diff --git a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rsindex 524ed1dd30..98910f1f4e 100644--- a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs@@ -16,7 +16,7 @@ use hyperswitch_domain_models::{MandateReference, PaymentsResponseData, RedirectForm, RefundsResponseData,},types::{- PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsPreProcessingRouterData,+ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData,PaymentsSettlementSplitCreateRouterData, PaymentsSyncRouterData, RefundsRouterData,},};@@ -29,9 +29,9 @@ use serde::{Deserialize, Serialize};use crate::{types::{- PaymentsCaptureResponseRouterData, PaymentsPreprocessingResponseRouterData,- PaymentsResponseRouterData, PaymentsSettlementSplitCreateResponseRouterData,- PaymentsSyncResponseRouterData, RefundsResponseRouterData,+ PaymentsCaptureResponseRouterData, PaymentsResponseRouterData,+ PaymentsSettlementSplitCreateResponseRouterData, PaymentsSyncResponseRouterData,+ RefundsResponseRouterData,},utils::{get_unimplemented_payment_method_error_message, CardData, PaymentsAuthorizeRequestData,@@ -678,85 +678,6 @@ impl TryFrom<PaymentsSettlementSplitCreateResponseRouterData<XenditSplitResponse}}-impl TryFrom<PaymentsPreprocessingResponseRouterData<XenditSplitResponse>>- for PaymentsPreProcessingRouterData-{- type Error = error_stack::Report<errors::ConnectorError>;-- fn try_from(- item: PaymentsPreprocessingResponseRouterData<XenditSplitResponse>,- ) -> Result<Self, Self::Error> {- let for_user_id = match item.data.request.split_payments {- Some(common_types::payments::SplitPaymentsRequest::XenditSplitPayment(- common_types::payments::XenditSplitRequest::MultipleSplits(ref split_data),- )) => split_data.for_user_id.clone(),- _ => None,- };-- let routes: Vec<common_types::payments::XenditSplitRoute> = item- .response- .routes- .iter()- .map(|route| {- let required_conversion_type = common_utils::types::FloatMajorUnitForConnector;- route- .flat_amount- .map(|amount| {- common_utils::types::AmountConvertor::convert_back(- &required_conversion_type,- amount,- item.data.request.currency.unwrap_or(Currency::USD),- )- .map_err(|_| {- errors::ConnectorError::RequestEncodingFailedWithReason(- "Failed to convert the amount into a major unit".to_owned(),- )- })- })- .transpose()- .map(|flat_amount| common_types::payments::XenditSplitRoute {- flat_amount,- percent_amount: route.percent_amount,- currency: route.currency,- destination_account_id: route.destination_account_id.clone(),- reference_id: route.reference_id.clone(),- })- })- .collect::<Result<Vec<_>, _>>()?;-- let charges = common_types::payments::XenditMultipleSplitResponse {- split_rule_id: item.response.id,- for_user_id,- name: item.response.name,- description: item.response.description,- routes,- };-- let response = PaymentsResponseData::TransactionResponse {- resource_id: ResponseId::NoResponseId,- redirection_data: Box::new(None),- mandate_reference: Box::new(None),- connector_metadata: None,- network_txn_id: None,- network_txn_link_id: None,- connector_response_reference_id: None,- incremental_authorization_allowed: None,- authentication_data: None,- charges: Some(- common_types::payments::ConnectorChargeResponseData::XenditSplitPayment(- common_types::payments::XenditChargeResponseData::MultipleSplits(charges),- ),- ),- payment_account_reference: None,- };-- Ok(Self {- response: Ok(response),- ..item.data- })- }-}-impl TryFrom<PaymentsSyncResponseRouterData<XenditResponse>> for PaymentsSyncRouterData {type Error = error_stack::Report<errors::ConnectorError>;fn try_from(item: PaymentsSyncResponseRouterData<XenditResponse>) -> Result<Self, Self::Error> {@@ -909,59 +830,6 @@ impl TryFrom<&PaymentsSettlementSplitCreateRouterData> for XenditSplitRequestDat}}-impl TryFrom<&PaymentsPreProcessingRouterData> for XenditSplitRequestData {- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(item: &PaymentsPreProcessingRouterData) -> Result<Self, Self::Error> {- if let Some(common_types::payments::SplitPaymentsRequest::XenditSplitPayment(- common_types::payments::XenditSplitRequest::MultipleSplits(ref split_data),- )) = item.request.split_payments.clone()- {- let routes: Vec<XenditSplitRoute> = split_data- .routes- .iter()- .map(|route| {- let required_conversion_type = common_utils::types::FloatMajorUnitForConnector;- route- .flat_amount- .map(|amount| {- common_utils::types::AmountConvertor::convert(- &required_conversion_type,- amount,- item.request.currency.unwrap_or(Currency::USD),- )- .map_err(|_| {- errors::ConnectorError::RequestEncodingFailedWithReason(- "Failed to convert the amount into a major unit".to_owned(),- )- })- })- .transpose()- .map(|flat_amount| XenditSplitRoute {- flat_amount,- percent_amount: route.percent_amount,- currency: route.currency,- destination_account_id: route.destination_account_id.clone(),- reference_id: route.reference_id.clone(),- })- })- .collect::<Result<Vec<_>, _>>()?;-- let split_data = XenditSplitRequest {- name: split_data.name.clone(),- description: split_data.description.clone(),- routes,- };-- Ok(Self { split_data })- } else {- Err(errors::ConnectorError::NotImplemented(- get_unimplemented_payment_method_error_message("Xendit"),- )- .into())- }- }-}-//TODO: Fill the struct with respective fields// REFUND :// Type definition for RefundRequestdiff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rsindex 45097ba09a..f6ffa0a13e 100644--- a/crates/hyperswitch_connectors/src/default_implementations.rs+++ b/crates/hyperswitch_connectors/src/default_implementations.rs@@ -2,7 +2,6 @@use common_enums::{CallConnectorAction, PaymentAction};// impl api::PaymentIncrementalAuthorization for Helcim {}// impl api::ConnectorCustomer for Helcim {}-// impl api::PaymentsPreProcessing for Helcim {}// impl api::PaymentReject for Helcim {}// impl api::PaymentApprove for Helcim {}use common_utils::errors::CustomResult;@@ -39,8 +38,8 @@ use hyperswitch_domain_models::{CompleteRefundSurchrge, CompleteSurcharge, CreateConnectorCustomer, CreateOrder,ExtendAuthorization, GenerateQr, GiftCardBalanceCheck, IncrementalAuthorization,PostCaptureVoid, PostCaptureVoidSync, PostProcessing, PostSessionTokens,- PreAuthorizeVoid, PreProcessing, PushNotification, Reject, SdkSessionUpdate,- SettlementSplitCreate, UpdateMetadata, UpdatePostConfirm,+ PreAuthorizeVoid, PushNotification, Reject, SdkSessionUpdate, SettlementSplitCreate,+ UpdateMetadata, UpdatePostConfirm,},subscriptions::{GetSubscriptionEstimate, GetSubscriptionItemPrices, GetSubscriptionItems,@@ -77,12 +76,11 @@ use hyperswitch_domain_models::{PaymentsCompleteRefundSurchrgeData, PaymentsCompleteSurchargeData,PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,- PaymentsPreAuthenticateData, PaymentsPreAuthorizeCancelData, PaymentsPreProcessingData,- PaymentsRejectData, PaymentsSurchargeCalculationData, PaymentsTaxCalculationData,- PaymentsUpdateMetadataData, PaymentsUpdatePostConfirmData, PushNotificationRequestData,- RetrieveFileRequestData, SdkPaymentsSessionUpdateData, SettlementSplitRequestData,- SubmitEvidenceRequestData, UploadFileRequestData, VaultRequestData,- VerifyWebhookSourceRequestData,+ PaymentsPreAuthenticateData, PaymentsPreAuthorizeCancelData, PaymentsRejectData,+ PaymentsSurchargeCalculationData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData,+ PaymentsUpdatePostConfirmData, PushNotificationRequestData, RetrieveFileRequestData,+ SdkPaymentsSessionUpdateData, SettlementSplitRequestData, SubmitEvidenceRequestData,+ UploadFileRequestData, VaultRequestData, VerifyWebhookSourceRequestData,},router_response_types::{merchant_connector_webhook_management::{@@ -169,8 +167,8 @@ use hyperswitch_interfaces::{PaymentUpdate, PaymentUpdateMetadata, PaymentsAuthenticate, PaymentsCompleteAuthorize,PaymentsCreateOrder, PaymentsGenerateQr, PaymentsGiftCardBalanceCheck,PaymentsPostAuthenticate, PaymentsPostProcessing, PaymentsPreAuthenticate,- PaymentsPreProcessing, PaymentsPushNotification, PaymentsSettlementSplitCreate,- SurchargeCalculation, SurchargeComplete, SurchargeRefund, TaxCalculation,+ PaymentsPushNotification, PaymentsSettlementSplitCreate, SurchargeCalculation,+ SurchargeComplete, SurchargeRefund, TaxCalculation,},revenue_recovery::RevenueRecovery,subscriptions::{@@ -3352,170 +3350,6 @@ default_imp_for_post_authenticate_steps!(connectors::Zsl);-macro_rules! default_imp_for_pre_processing_steps{- ($($path:ident::$connector:ident),*)=> {- $(- impl PaymentsPreProcessing for $path::$connector {}- impl- ConnectorIntegration<- PreProcessing,- PaymentsPreProcessingData,- PaymentsResponseData,- > for $path::$connector- {}- )*- };-}--default_imp_for_pre_processing_steps!(- connectors::Payconex,- connectors::Paydotcom,- connectors::Citigate,- connectors::Worldpayraft,- connectors::Paynearme,- connectors::Revolv3,- connectors::Saferpay,- connectors::TsysTransit,- connectors::AbsaSanlam,- connectors::Zift,- connectors::Trustpayments,- connectors::Silverflow,- connectors::Vgs,- connectors::Aci,- connectors::Adyenplatform,- connectors::Affirm,- connectors::Airwallex,- connectors::Amazonpay,- connectors::Archipel,- connectors::Authipay,- connectors::Authorizedotnet,- connectors::Bambora,- connectors::Bamboraapac,- connectors::Bankofamerica,- connectors::Billwerk,- connectors::Bitpay,- connectors::Calida,- connectors::Bluesnap,- connectors::Braintree,- connectors::Boku,- connectors::Breadpay,- connectors::Cashtocode,- connectors::Celero,- connectors::Chargebee,- connectors::Checkbook,- connectors::Checkout,- connectors::Coinbase,- connectors::Coingate,- connectors::Cryptopay,- connectors::Custombilling,- connectors::Cybersourcedecisionmanager,- connectors::D24,- connectors::Datatrans,- connectors::Deutschebank,- connectors::Digitalvirgo,- connectors::Dlocal,- connectors::Dwolla,- connectors::Ebanx,- connectors::Elavon,- connectors::Envoy,- connectors::Etisalat,- connectors::Facilitapay,- connectors::Finix,- connectors::Fiserv,- connectors::Fiservcommercehub,- connectors::Fiservemea,- connectors::Fiuu,- connectors::Flexiti,- connectors::Forte,- connectors::Getnet,- connectors::Gigadat,- connectors::Givepayments,- connectors::Globalpay,- connectors::GlobalpaymentsHeartland,- connectors::Globepay,- connectors::Gpayments,- connectors::Hipay,- connectors::Hyperpg,- connectors::Helcim,- connectors::HyperswitchVault,- connectors::Hyperwallet,- connectors::Iatapay,- connectors::Ilixium,- connectors::JpmorganOrbital,- connectors::Imerchantsolutions,- connectors::Inespay,- connectors::Interpayments,- connectors::Itaubank,- connectors::Jpmorgan,- connectors::Juspaythreedsserver,- connectors::Katapult,- connectors::Klarna,- connectors::Loonio,- connectors::Merchante,- connectors::Netcetera,- connectors::Nomupay,- connectors::Noon,- connectors::Novalnet,- connectors::Nexinets,- connectors::Opayo,- connectors::Opennode,- connectors::Paybox,- connectors::Payeezy,- connectors::Payjustnow,- connectors::Payjustnowinstore,- connectors::Payload,- connectors::Paystack,- connectors::Paytm,- connectors::Payone,- connectors::Payu,- connectors::Peachpayments,- connectors::Phonepe,- connectors::Placetopay,- connectors::Plaid,- connectors::Powertranz,- connectors::Prophetpay,- connectors::Mifinity,- connectors::Mollie,- connectors::Moneris,- connectors::Mpgs,- connectors::Multisafepay,- connectors::Rapyd,- connectors::Razorpay,- connectors::Recurly,- connectors::Riskified,- connectors::SanlamPayshield,- connectors::Santander,- connectors::Sift,- connectors::Signifyd,- connectors::Nsure,- connectors::Stax,- connectors::Square,- connectors::Stripe,- connectors::Stripebilling,- connectors::Taxjar,- connectors::Tesouro,- connectors::Threedsecureio,- connectors::Thunes,- connectors::Tokenex,- connectors::Tokenio,- connectors::Truelayer,- connectors::Trustly,- connectors::Tsys,- connectors::UnifiedAuthenticationService,- connectors::Wise,- connectors::Worldline,- connectors::Worldpay,- connectors::Worldpaymodular,- connectors::Worldpayvantiv,- connectors::Worldpayxml,- connectors::Wellsfargo,- connectors::Wellsfargopayout,- connectors::Volt,- connectors::Zen,- connectors::Zsl,- connectors::CtpMastercard-);-macro_rules! default_imp_for_post_processing_steps{($($path:ident::$connector:ident),*)=> {$(@@ -12439,15 +12273,6 @@ impl<const T: u8>{}-#[cfg(feature = "dummy_connector")]-impl<const T: u8> PaymentsPreProcessing for connectors::DummyConnector<T> {}-#[cfg(feature = "dummy_connector")]-impl<const T: u8>- ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>- for connectors::DummyConnector<T>-{-}-#[cfg(feature = "dummy_connector")]impl<const T: u8> PaymentsPostProcessing for connectors::DummyConnector<T> {}#[cfg(feature = "dummy_connector")]diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rsindex 6ab2f683bd..210a22394d 100644--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs@@ -26,8 +26,8 @@ use hyperswitch_domain_models::{CreateOrder, ExtendAuthorization, ExternalVaultProxy, GenerateQr, GiftCardBalanceCheck,IncrementalAuthorization, PSync, PaymentMethodToken, PostCaptureVoid,PostCaptureVoidSync, PostProcessing, PostSessionTokens, PreAuthorizeVoid,- PreProcessing, PushNotification, Reject, SdkSessionUpdate, Session,- SettlementSplitCreate, SetupMandate, UpdateMetadata, UpdatePostConfirm, Void,+ PushNotification, Reject, SdkSessionUpdate, Session, SettlementSplitCreate,+ SetupMandate, UpdateMetadata, UpdatePostConfirm, Void,},refunds::{Execute, RSync, VoidPostRefund},revenue_recovery::{@@ -58,13 +58,13 @@ use hyperswitch_domain_models::{PaymentsCompleteRefundSurchrgeData, PaymentsCompleteSurchargeData,PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,- PaymentsPreAuthenticateData, PaymentsPreAuthorizeCancelData, PaymentsPreProcessingData,- PaymentsRejectData, PaymentsSessionData, PaymentsSurchargeCalculationData,- PaymentsSyncData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData,- PaymentsUpdatePostConfirmData, PushNotificationRequestData, RefundsData,- RetrieveFileRequestData, SdkPaymentsSessionUpdateData, SettlementSplitRequestData,- SetupMandateRequestData, SubmitEvidenceRequestData, UploadFileRequestData,- VaultRequestData, VerifyWebhookSourceRequestData,+ PaymentsPreAuthenticateData, PaymentsPreAuthorizeCancelData, PaymentsRejectData,+ PaymentsSessionData, PaymentsSurchargeCalculationData, PaymentsSyncData,+ PaymentsTaxCalculationData, PaymentsUpdateMetadataData, PaymentsUpdatePostConfirmData,+ PushNotificationRequestData, RefundsData, RetrieveFileRequestData,+ SdkPaymentsSessionUpdateData, SettlementSplitRequestData, SetupMandateRequestData,+ SubmitEvidenceRequestData, UploadFileRequestData, VaultRequestData,+ VerifyWebhookSourceRequestData,},router_response_types::{merchant_connector_webhook_management::{@@ -136,9 +136,8 @@ use hyperswitch_interfaces::{PaymentSyncV2, PaymentTokenV2, PaymentUpdateMetadataV2, PaymentUpdatePostConfirmV2,PaymentV2, PaymentVoidV2, PaymentsAuthenticateV2, PaymentsCompleteAuthorizeV2,PaymentsGenerateQrV2, PaymentsGiftCardBalanceCheckV2, PaymentsPostAuthenticateV2,- PaymentsPostProcessingV2, PaymentsPreAuthenticateV2, PaymentsPreProcessingV2,- PaymentsPushNotificationV2, PaymentsSettlementSplitCreate, SurchargeCalculationV2,- TaxCalculationV2,+ PaymentsPostProcessingV2, PaymentsPreAuthenticateV2, PaymentsPushNotificationV2,+ PaymentsSettlementSplitCreate, SurchargeCalculationV2, TaxCalculationV2,},refunds_v2::{RefundExecuteV2, RefundSyncV2, RefundV2, RefundVoidPostRefundV2},revenue_recovery_v2::{@@ -178,7 +177,6 @@ macro_rules! default_imp_for_new_connector_integration_payment {impl PaymentsCompleteAuthorizeV2 for $path::$connector{}impl PaymentTokenV2 for $path::$connector{}impl ConnectorCustomerV2 for $path::$connector{}- impl PaymentsPreProcessingV2 for $path::$connector{}impl PaymentsSettlementSplitCreate for $path::$connector{}impl PaymentsGiftCardBalanceCheckV2 for $path::$connector{}impl PaymentsPreAuthenticateV2 for $path::$connector{}@@ -266,12 +264,6 @@ macro_rules! default_imp_for_new_connector_integration_payment {ConnectorCustomerData,PaymentsResponseData,> for $path::$connector{}- impl ConnectorIntegrationV2<- PreProcessing,- PaymentFlowData,- PaymentsPreProcessingData,- PaymentsResponseData,- > for $path::$connector{}impl ConnectorIntegrationV2<SettlementSplitCreate,diff --git a/crates/hyperswitch_connectors/src/types.rs b/crates/hyperswitch_connectors/src/types.rsindex 5c2cd32b8f..5adc8a8e79 100644--- a/crates/hyperswitch_connectors/src/types.rs+++ b/crates/hyperswitch_connectors/src/types.rs@@ -10,7 +10,7 @@ use hyperswitch_domain_models::{},unified_authentication_service::{Authenticate, PostAuthenticate, PreAuthenticate},Accept, AccessTokenAuth, Authorize, Capture, CreateOrder, Defend, Dsync, Evidence,- ExtendAuthorization, Fetch, PSync, PostProcessing, PreProcessing, Retrieve, Session,+ ExtendAuthorization, Fetch, PSync, PostProcessing, Retrieve, Session,SettlementSplitCreate, Upload, Void,},router_request_types::{@@ -22,9 +22,9 @@ use hyperswitch_domain_models::{DefendDisputeRequestData, DisputeSyncData, FetchDisputesRequestData,PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,PaymentsExtendAuthorizationData, PaymentsPostAuthenticateData, PaymentsPostProcessingData,- PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsSessionData,- PaymentsSyncData, RefundsData, RetrieveFileRequestData, SettlementSplitRequestData,- SubmitEvidenceRequestData, UploadFileRequestData,+ PaymentsPreAuthenticateData, PaymentsSessionData, PaymentsSyncData, RefundsData,+ RetrieveFileRequestData, SettlementSplitRequestData, SubmitEvidenceRequestData,+ UploadFileRequestData,},router_response_types::{AcceptDisputeResponse, AuthenticationResponseData, DefendDisputeResponse,@@ -63,8 +63,6 @@ pub(crate) type PaymentsPreAuthenticateResponseRouterData<R> =ResponseRouterData<PreAuthenticate, R, PaymentsPreAuthenticateData, PaymentsResponseData>;pub(crate) type PaymentsSettlementSplitCreateResponseRouterData<R> =ResponseRouterData<SettlementSplitCreate, R, SettlementSplitRequestData, PaymentsResponseData>;-pub(crate) type PaymentsPreprocessingResponseRouterData<R> =- ResponseRouterData<PreProcessing, R, PaymentsPreProcessingData, PaymentsResponseData>;pub(crate) type PaymentsSessionResponseRouterData<R> =ResponseRouterData<Session, R, PaymentsSessionData, PaymentsResponseData>;pub(crate) type CreateOrderResponseRouterData<R> =diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rsindex 169ebd1bac..40aa3bb9fe 100644--- a/crates/hyperswitch_connectors/src/utils.rs+++ b/crates/hyperswitch_connectors/src/utils.rs@@ -67,8 +67,8 @@ use hyperswitch_domain_models::{MandateRevokeRequestData, PaymentMethodTokenizationData, PaymentsAuthenticateData,PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,PaymentsPostAuthenticateData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,- PaymentsPreProcessingData, PaymentsSyncData, RefundIntegrityObject, RefundsData,- ResponseId, SetupMandateRequestData, SyncIntegrityObject,+ PaymentsSyncData, RefundIntegrityObject, RefundsData, ResponseId, SetupMandateRequestData,+ SyncIntegrityObject,},router_response_types::{CaptureSyncResponse, PaymentsResponseData},types::{OrderDetailsWithAmount, SetupMandateRouterData},@@ -3386,115 +3386,6 @@ impl PaymentsAuthenticateRequestData for PaymentsAuthenticateData {}}-pub trait PaymentsPreProcessingRequestData {- fn get_redirect_response_payload(&self) -> Result<pii::SecretSerdeValue, Error>;- fn get_email(&self) -> Result<Email, Error>;- fn get_payment_method_type(&self) -> Result<enums::PaymentMethodType, Error>;- fn get_currency(&self) -> Result<enums::Currency, Error>;- fn get_amount(&self) -> i64;- fn get_minor_amount(&self) -> MinorUnit;- fn is_auto_capture(&self) -> Result<bool, Error>;- fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error>;- fn get_webhook_url(&self) -> Result<String, Error>;- fn get_router_return_url(&self) -> Result<String, Error>;- fn get_browser_info(&self) -> Result<BrowserInformation, Error>;- fn get_complete_authorize_url(&self) -> Result<String, Error>;- fn connector_mandate_id(&self) -> Option<String>;- fn get_payment_method_data(&self) -> Result<PaymentMethodData, Error>;- fn is_customer_initiated_mandate_payment(&self) -> bool;-}--impl PaymentsPreProcessingRequestData for PaymentsPreProcessingData {- fn get_email(&self) -> Result<Email, Error> {- self.email.clone().ok_or_else(missing_field_err("email"))- }- fn get_payment_method_type(&self) -> Result<enums::PaymentMethodType, Error> {- self.payment_method_type- .to_owned()- .ok_or_else(missing_field_err("payment_method_type"))- }- fn get_payment_method_data(&self) -> Result<PaymentMethodData, Error> {- self.payment_method_data- .to_owned()- .ok_or_else(missing_field_err("payment_method_data"))- }- fn get_currency(&self) -> Result<enums::Currency, Error> {- self.currency.ok_or_else(missing_field_err("currency"))- }- fn get_amount(&self) -> i64 {- self.amount- }-- // New minor amount function for amount framework- fn get_minor_amount(&self) -> MinorUnit {- self.minor_amount- }- fn is_auto_capture(&self) -> Result<bool, Error> {- match self.capture_method {- Some(enums::CaptureMethod::Automatic)- | None- | Some(enums::CaptureMethod::SequentialAutomatic) => Ok(true),- Some(enums::CaptureMethod::Manual) => Ok(false),- Some(enums::CaptureMethod::ManualMultiple) | Some(enums::CaptureMethod::Scheduled) => {- Err(errors::ConnectorError::CaptureMethodNotSupported.into())- }- }- }- fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error> {- self.order_details- .clone()- .ok_or_else(missing_field_err("order_details"))- }- fn get_webhook_url(&self) -> Result<String, Error> {- self.webhook_url- .clone()- .ok_or_else(missing_field_err("webhook_url"))- }- fn get_router_return_url(&self) -> Result<String, Error> {- self.router_return_url- .clone()- .ok_or_else(missing_field_err("return_url"))- }- fn get_browser_info(&self) -> Result<BrowserInformation, Error> {- self.browser_info- .clone()- .ok_or_else(missing_field_err("browser_info"))- }- fn get_complete_authorize_url(&self) -> Result<String, Error> {- self.complete_authorize_url- .clone()- .ok_or_else(missing_field_err("complete_authorize_url"))- }- fn get_redirect_response_payload(&self) -> Result<pii::SecretSerdeValue, Error> {- self.redirect_response- .as_ref()- .and_then(|res| res.payload.to_owned())- .ok_or(- errors::ConnectorError::MissingConnectorRedirectionPayload {- field_name: "request.redirect_response.payload".into(),- }- .into(),- )- }- fn connector_mandate_id(&self) -> Option<String> {- self.mandate_id- .as_ref()- .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id {- Some(mandates::MandateReferenceId::ConnectorMandateId(connector_mandate_ids)) => {- connector_mandate_ids.get_connector_mandate_id()- }- Some(mandates::MandateReferenceId::NetworkMandateId(_))- | Some(mandates::MandateReferenceId::CardWithLimitedData(_))- | None- | Some(mandates::MandateReferenceId::NetworkTokenWithNTI(_)) => None,- })- }- fn is_customer_initiated_mandate_payment(&self) -> bool {- (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some())- && self.setup_future_usage == Some(FutureUsage::OffSession)- }-}-pub trait BrowserInformationData {fn get_accept_header(&self) -> Result<String, Error>;fn get_language(&self) -> Result<String, Error>;diff --git a/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs b/crates/hyperswitch_domain_models/src/router_flow_types/payments.rsindex 20cdeffda0..79884d2959 100644--- a/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs+++ b/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs@@ -50,9 +50,6 @@ pub struct CreateConnectorCustomer;#[derive(Debug, Clone)]pub struct SetupMandate;-#[derive(Debug, Clone)]-pub struct PreProcessing;-#[derive(Debug, Clone)]pub struct PushNotification;diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rsindex 49f874993b..9360620070 100644--- a/crates/hyperswitch_domain_models/src/router_request_types.rs+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs@@ -424,44 +424,6 @@ impl TryFrom<SetupMandateRequestData> for ConnectorCustomerData {}}-impl TryFrom<SetupMandateRequestData> for PaymentsPreProcessingData {- type Error = error_stack::Report<ApiErrorResponse>;-- fn try_from(data: SetupMandateRequestData) -> Result<Self, Self::Error> {- let device_channel = Some(BrowserInformation::resolve_device_channel(- data.browser_info.as_ref(),- ));- Ok(Self {- payment_method_data: Some(data.payment_method_data),- amount: data.amount,- minor_amount: data.minor_amount,- email: data.email,- currency: Some(data.currency),- payment_method_type: data.payment_method_type,- setup_mandate_details: data.setup_mandate_details,- capture_method: data.capture_method,- order_details: None,- router_return_url: data.router_return_url,- webhook_url: data.webhook_url,- complete_authorize_url: data.complete_authorize_url,- browser_info: data.browser_info,- device_channel,- surcharge_details: None,- connector_transaction_id: None,- mandate_id: data.mandate_id,- related_transaction_id: None,- redirect_response: None,- enrolled_for_3ds: false,- split_payments: None,- metadata: data.metadata,- customer_acceptance: data.customer_acceptance,- setup_future_usage: data.setup_future_usage,- is_stored_credential: data.is_stored_credential,- force_3ds_challenge: None,- })- }-}-impl TryFrom<SetupMandateRequestData> for PushNotificationRequestData {type Error = error_stack::Report<ApiErrorResponse>;@@ -759,37 +721,6 @@ impl TryFrom<ExternalVaultProxyPaymentsData> for CreateOrderRequestData {}}-#[derive(Debug, Clone, Serialize)]-pub struct PaymentsPreProcessingData {- pub payment_method_data: Option<PaymentMethodData>,- pub amount: i64,- pub email: Option<pii::Email>,- pub currency: Option<storage_enums::Currency>,- pub payment_method_type: Option<storage_enums::PaymentMethodType>,- pub setup_mandate_details: Option<mandates::MandateData>,- pub capture_method: Option<storage_enums::CaptureMethod>,- pub order_details: Option<Vec<OrderDetailsWithAmount>>,- pub router_return_url: Option<String>,- pub webhook_url: Option<String>,- pub complete_authorize_url: Option<String>,- pub surcharge_details: Option<SurchargeDetails>,- pub browser_info: Option<BrowserInformation>,- pub device_channel: Option<api_models::payments::DeviceChannel>,- pub connector_transaction_id: Option<String>,- pub enrolled_for_3ds: bool,- pub mandate_id: Option<mandates::MandateIds>,- pub related_transaction_id: Option<String>,- pub redirect_response: Option<CompleteAuthorizeRedirectResponse>,- pub metadata: Option<Secret<serde_json::Value>>,- pub split_payments: Option<common_types::payments::SplitPaymentsRequest>,- pub customer_acceptance: Option<common_payments_types::CustomerAcceptance>,- pub setup_future_usage: Option<storage_enums::FutureUsage>,- // New amount for amount frame work- pub minor_amount: MinorUnit,- pub is_stored_credential: Option<bool>,- pub force_3ds_challenge: Option<bool>,-}-#[derive(Debug, Clone, Serialize)]pub struct GiftCardBalanceCheckRequestData {pub payment_method_data: PaymentMethodData,@@ -835,44 +766,6 @@ impl TryFrom<PaymentsAuthorizeData> for GiftCardBalanceCheckRequestData {}}-impl TryFrom<PaymentsAuthorizeData> for PaymentsPreProcessingData {- type Error = error_stack::Report<ApiErrorResponse>;-- fn try_from(data: PaymentsAuthorizeData) -> Result<Self, Self::Error> {- let device_channel = Some(BrowserInformation::resolve_device_channel(- data.browser_info.as_ref(),- ));- Ok(Self {- payment_method_data: Some(data.payment_method_data),- amount: data.amount,- minor_amount: data.minor_amount,- email: data.email,- currency: Some(data.currency),- payment_method_type: data.payment_method_type,- setup_mandate_details: data.setup_mandate_details,- capture_method: data.capture_method,- order_details: data.order_details,- router_return_url: data.router_return_url,- webhook_url: data.webhook_url,- complete_authorize_url: data.complete_authorize_url,- browser_info: data.browser_info,- device_channel,- surcharge_details: data.surcharge_details,- connector_transaction_id: None,- mandate_id: data.mandate_id,- related_transaction_id: data.related_transaction_id,- redirect_response: None,- enrolled_for_3ds: data.enrolled_for_3ds,- split_payments: data.split_payments,- metadata: data.metadata.map(Secret::new),- customer_acceptance: data.customer_acceptance,- setup_future_usage: data.setup_future_usage,- is_stored_credential: data.is_stored_credential,- force_3ds_challenge: None,- })- }-}-#[derive(Debug, Clone, Serialize)]pub struct PaymentsPreAuthenticateData {pub payment_method_data: PaymentMethodData,@@ -1053,44 +946,6 @@ impl TryFrom<CompleteAuthorizeData> for PaymentsPostAuthenticateData {}}-impl TryFrom<CompleteAuthorizeData> for PaymentsPreProcessingData {- type Error = error_stack::Report<ApiErrorResponse>;-- fn try_from(data: CompleteAuthorizeData) -> Result<Self, Self::Error> {- let device_channel = Some(BrowserInformation::resolve_device_channel(- data.browser_info.as_ref(),- ));- Ok(Self {- payment_method_data: data.payment_method_data,- amount: data.amount,- minor_amount: data.minor_amount,- email: data.email,- currency: Some(data.currency),- payment_method_type: None,- setup_mandate_details: data.setup_mandate_details,- capture_method: data.capture_method,- order_details: None,- router_return_url: None,- webhook_url: None,- complete_authorize_url: data.complete_authorize_url,- browser_info: data.browser_info,- device_channel,- surcharge_details: None,- connector_transaction_id: data.connector_transaction_id,- mandate_id: data.mandate_id,- related_transaction_id: None,- redirect_response: data.redirect_response,- split_payments: None,- enrolled_for_3ds: true,- metadata: data.connector_meta.map(Secret::new),- customer_acceptance: data.customer_acceptance,- setup_future_usage: data.setup_future_usage,- is_stored_credential: data.is_stored_credential,- force_3ds_challenge: data.force_3ds_challenge,- })- }-}-#[derive(Debug, Clone, Serialize)]pub struct PaymentsPostProcessingData {pub payment_method_data: PaymentMethodData,diff --git a/crates/hyperswitch_domain_models/src/types.rs b/crates/hyperswitch_domain_models/src/types.rsindex 410ee493eb..db1c95bdca 100644--- a/crates/hyperswitch_domain_models/src/types.rs+++ b/crates/hyperswitch_domain_models/src/types.rs@@ -19,7 +19,7 @@ use crate::{CompleteRefundSurchrge, CompleteSurcharge, CreateConnectorCustomer, CreateOrder, Execute,ExtendAuthorization, ExternalVaultProxy, GenerateQr, GiftCardBalanceCheck,IncrementalAuthorization, PSync, PaymentMethodToken, PostAuthenticate, PostCaptureVoid,- PostCaptureVoidSync, PostSessionTokens, PreAuthenticate, PreAuthorizeVoid, PreProcessing,+ PostCaptureVoidSync, PostSessionTokens, PreAuthenticate, PreAuthorizeVoid,ProcessIncomingWebhook, PushNotification, RSync, SdkSessionUpdate, Session,SettlementSplitCreate, SetupMandate, UpdateMetadata, UpdatePostConfirm,VerifyWebhookSource, Void,@@ -51,11 +51,11 @@ use crate::{PaymentsCompleteSurchargeData, PaymentsExtendAuthorizationData,PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,PaymentsPostSessionTokensData, PaymentsPreAuthenticateData, PaymentsPreAuthorizeCancelData,- PaymentsPreProcessingData, PaymentsSessionData, PaymentsSurchargeCalculationData,- PaymentsSyncData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData,- PaymentsUpdatePostConfirmData, PushNotificationRequestData, RefundsData,- SdkPaymentsSessionUpdateData, SettlementSplitRequestData, SetupMandateRequestData,- VaultRequestData, VerifyWebhookSourceRequestData,+ PaymentsSessionData, PaymentsSurchargeCalculationData, PaymentsSyncData,+ PaymentsTaxCalculationData, PaymentsUpdateMetadataData, PaymentsUpdatePostConfirmData,+ PushNotificationRequestData, RefundsData, SdkPaymentsSessionUpdateData,+ SettlementSplitRequestData, SetupMandateRequestData, VaultRequestData,+ VerifyWebhookSourceRequestData,},router_response_types::{merchant_connector_webhook_management::{@@ -85,8 +85,6 @@ pub type ExternalVaultProxyPaymentsRouterData =RouterData<ExternalVaultProxy, ExternalVaultProxyPaymentsData, PaymentsResponseData>;pub type PaymentsAuthorizeSessionTokenRouterData =RouterData<AuthorizeSessionToken, AuthorizeSessionTokenData, PaymentsResponseData>;-pub type PaymentsPreProcessingRouterData =- RouterData<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>;pub type PaymentsPushNotificationRouterData =RouterData<PushNotification, PushNotificationRequestData, PaymentsResponseData>;pub type PaymentsGenerateQrRouterData =diff --git a/crates/hyperswitch_interfaces/src/api/payments.rs b/crates/hyperswitch_interfaces/src/api/payments.rsindex c2d4687600..aa16055fb2 100644--- a/crates/hyperswitch_interfaces/src/api/payments.rs+++ b/crates/hyperswitch_interfaces/src/api/payments.rs@@ -7,7 +7,7 @@ use hyperswitch_domain_models::{CompleteAuthorize, CompleteRefundSurchrge, CompleteSurcharge, CreateConnectorCustomer,ExtendAuthorization, GenerateQr, IncrementalAuthorization, PSync, PaymentMethodToken,PostCaptureVoid, PostCaptureVoidSync, PostProcessing, PostSessionTokens,- PreAuthorizeVoid, PreProcessing, PushNotification, Reject, SdkSessionUpdate, Session,+ PreAuthorizeVoid, PushNotification, Reject, SdkSessionUpdate, Session,SettlementSplitCreate, SetupMandate, UpdateMetadata, Void,},Authenticate, CreateOrder, ExternalVaultProxy, GiftCardBalanceCheck, PostAuthenticate,@@ -22,11 +22,11 @@ use hyperswitch_domain_models::{PaymentsCompleteRefundSurchrgeData, PaymentsCompleteSurchargeData,PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,- PaymentsPreAuthenticateData, PaymentsPreAuthorizeCancelData, PaymentsPreProcessingData,- PaymentsRejectData, PaymentsSessionData, PaymentsSurchargeCalculationData,- PaymentsSyncData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData,- PaymentsUpdatePostConfirmData, PushNotificationRequestData, SdkPaymentsSessionUpdateData,- SettlementSplitRequestData, SetupMandateRequestData,+ PaymentsPreAuthenticateData, PaymentsPreAuthorizeCancelData, PaymentsRejectData,+ PaymentsSessionData, PaymentsSurchargeCalculationData, PaymentsSyncData,+ PaymentsTaxCalculationData, PaymentsUpdateMetadataData, PaymentsUpdatePostConfirmData,+ PushNotificationRequestData, SdkPaymentsSessionUpdateData, SettlementSplitRequestData,+ SetupMandateRequestData,},router_response_types::{CompleteRefundSurchrgeResponseData, CompleteSurchargeResponseData,@@ -250,12 +250,6 @@ pub trait ConnectorCustomer:{}-/// trait PaymentsPreProcessing-pub trait PaymentsPreProcessing:- api::ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>-{-}-/// trait PaymentsPreAuthenticatepub trait PaymentsPreAuthenticate:api::ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>diff --git a/crates/hyperswitch_interfaces/src/api/payments_v2.rs b/crates/hyperswitch_interfaces/src/api/payments_v2.rsindex 73326da77c..a801d783dd 100644--- a/crates/hyperswitch_interfaces/src/api/payments_v2.rs+++ b/crates/hyperswitch_interfaces/src/api/payments_v2.rs@@ -9,8 +9,8 @@ use hyperswitch_domain_models::{CreateOrder, ExtendAuthorization, ExternalVaultProxy, GenerateQr,IncrementalAuthorization, PSync, PaymentMethodToken, PostCaptureVoid,PostCaptureVoidSync, PostProcessing, PostSessionTokens, PreAuthorizeVoid,- PreProcessing, PushNotification, Reject, SdkSessionUpdate, Session,- SettlementSplitCreate, SetupMandate, UpdateMetadata, UpdatePostConfirm, Void,+ PushNotification, Reject, SdkSessionUpdate, Session, SettlementSplitCreate,+ SetupMandate, UpdateMetadata, UpdatePostConfirm, Void,},Authenticate, GiftCardBalanceCheck, PostAuthenticate, PreAuthenticate,},@@ -23,11 +23,11 @@ use hyperswitch_domain_models::{PaymentsCompleteRefundSurchrgeData, PaymentsCompleteSurchargeData,PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,- PaymentsPreAuthenticateData, PaymentsPreAuthorizeCancelData, PaymentsPreProcessingData,- PaymentsRejectData, PaymentsSessionData, PaymentsSurchargeCalculationData,- PaymentsSyncData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData,- PaymentsUpdatePostConfirmData, PushNotificationRequestData, SdkPaymentsSessionUpdateData,- SettlementSplitRequestData, SetupMandateRequestData,+ PaymentsPreAuthenticateData, PaymentsPreAuthorizeCancelData, PaymentsRejectData,+ PaymentsSessionData, PaymentsSurchargeCalculationData, PaymentsSyncData,+ PaymentsTaxCalculationData, PaymentsUpdateMetadataData, PaymentsUpdatePostConfirmData,+ PushNotificationRequestData, SdkPaymentsSessionUpdateData, SettlementSplitRequestData,+ SetupMandateRequestData,},router_response_types::{CompleteRefundSurchrgeResponseData, CompleteSurchargeResponseData,@@ -281,17 +281,6 @@ pub trait ConnectorCustomerV2:{}-/// trait PaymentsPreProcessingV2-pub trait PaymentsPreProcessingV2:- ConnectorIntegrationV2<- PreProcessing,- PaymentFlowData,- PaymentsPreProcessingData,- PaymentsResponseData,->-{-}-/// trait PaymentsSettlementSplitCreatepub trait PaymentsSettlementSplitCreate:ConnectorIntegrationV2<diff --git a/crates/hyperswitch_interfaces/src/types.rs b/crates/hyperswitch_interfaces/src/types.rsindex 7d60db65ce..6cad86175d 100644--- a/crates/hyperswitch_interfaces/src/types.rs+++ b/crates/hyperswitch_interfaces/src/types.rs@@ -16,8 +16,8 @@ use hyperswitch_domain_models::{CompleteAuthorize, CompleteRefundSurchrge, CompleteSurcharge, CreateConnectorCustomer,CreateOrder, ExtendAuthorization, GenerateQr, IncrementalAuthorization, InitPayment,PSync, PaymentMethodToken, PostCaptureVoid, PostCaptureVoidSync, PostProcessing,- PostSessionTokens, PreAuthorizeVoid, PreProcessing, PushNotification, SdkSessionUpdate,- Session, SettlementSplitCreate, SetupMandate, UpdateMetadata, UpdatePostConfirm, Void,+ PostSessionTokens, PreAuthorizeVoid, PushNotification, SdkSessionUpdate, Session,+ SettlementSplitCreate, SetupMandate, UpdateMetadata, UpdatePostConfirm, Void,},refunds::{Execute, RSync},revenue_recovery::{BillingConnectorPaymentsSync, DisputeRecordBack, InvoiceRecordBack},@@ -64,12 +64,12 @@ use hyperswitch_domain_models::{PaymentsCompleteSurchargeData, PaymentsExtendAuthorizationData,PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,- PaymentsPreAuthorizeCancelData, PaymentsPreProcessingData, PaymentsSessionData,- PaymentsSurchargeCalculationData, PaymentsSyncData, PaymentsTaxCalculationData,- PaymentsUpdateMetadataData, PaymentsUpdatePostConfirmData, PushNotificationRequestData,- RefundsData, RetrieveFileRequestData, SdkPaymentsSessionUpdateData,- SettlementSplitRequestData, SetupMandateRequestData, SubmitEvidenceRequestData,- UploadFileRequestData, VaultRequestData, VerifyWebhookSourceRequestData,+ PaymentsPreAuthorizeCancelData, PaymentsSessionData, PaymentsSurchargeCalculationData,+ PaymentsSyncData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData,+ PaymentsUpdatePostConfirmData, PushNotificationRequestData, RefundsData,+ RetrieveFileRequestData, SdkPaymentsSessionUpdateData, SettlementSplitRequestData,+ SetupMandateRequestData, SubmitEvidenceRequestData, UploadFileRequestData,+ VaultRequestData, VerifyWebhookSourceRequestData,},router_response_types::{merchant_connector_webhook_management::{@@ -180,10 +180,6 @@ pub type MandateRevokeType =/// Type alias for `ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseData>`pub type CreateOrderType =dyn ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseData>;-/// Type alias for `ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>`-pub type PaymentsPreProcessingType =- dyn ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>;-/// Type alias for `ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>`pub type PaymentsPreAuthenticateType =dyn ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>;diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rsindex a03633dbdf..1f83a99088 100644--- a/crates/router/src/connector/utils.rs+++ b/crates/router/src/connector/utils.rs@@ -779,103 +779,6 @@ impl AddressData for hyperswitch_domain_models::address::Address {}}-pub trait PaymentsPreProcessingData {- fn get_redirect_response_payload(&self) -> Result<pii::SecretSerdeValue, Error>;- fn get_email(&self) -> Result<Email, Error>;- fn get_payment_method_type(&self) -> Result<enums::PaymentMethodType, Error>;- fn get_currency(&self) -> Result<enums::Currency, Error>;- fn get_amount(&self) -> i64;- fn get_minor_amount(&self) -> MinorUnit;- fn is_auto_capture(&self) -> Result<bool, Error>;- fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error>;- fn get_webhook_url(&self) -> Result<String, Error>;- fn get_router_return_url(&self) -> Result<String, Error>;- fn get_browser_info(&self) -> Result<BrowserInformation, Error>;- fn get_complete_authorize_url(&self) -> Result<String, Error>;- fn connector_mandate_id(&self) -> Option<String>;-}--impl PaymentsPreProcessingData for types::PaymentsPreProcessingData {- fn get_email(&self) -> Result<Email, Error> {- self.email.clone().ok_or_else(missing_field_err("email"))- }- fn get_payment_method_type(&self) -> Result<enums::PaymentMethodType, Error> {- self.payment_method_type- .to_owned()- .ok_or_else(missing_field_err("payment_method_type"))- }- fn get_currency(&self) -> Result<enums::Currency, Error> {- self.currency.ok_or_else(missing_field_err("currency"))- }- fn get_amount(&self) -> i64 {- self.amount- }-- // New minor amount function for amount framework- fn get_minor_amount(&self) -> MinorUnit {- self.minor_amount- }-- fn is_auto_capture(&self) -> Result<bool, Error> {- match self.capture_method {- Some(enums::CaptureMethod::Automatic)- | None- | Some(enums::CaptureMethod::SequentialAutomatic) => Ok(true),- Some(enums::CaptureMethod::Manual) => Ok(false),- Some(_) => Err(errors::ConnectorError::CaptureMethodNotSupported.into()),- }- }- fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error> {- self.order_details- .clone()- .ok_or_else(missing_field_err("order_details"))- }- fn get_webhook_url(&self) -> Result<String, Error> {- self.webhook_url- .clone()- .ok_or_else(missing_field_err("webhook_url"))- }- fn get_router_return_url(&self) -> Result<String, Error> {- self.router_return_url- .clone()- .ok_or_else(missing_field_err("return_url"))- }- fn get_browser_info(&self) -> Result<BrowserInformation, Error> {- self.browser_info- .clone()- .ok_or_else(missing_field_err("browser_info"))- }- fn get_complete_authorize_url(&self) -> Result<String, Error> {- self.complete_authorize_url- .clone()- .ok_or_else(missing_field_err("complete_authorize_url"))- }- fn get_redirect_response_payload(&self) -> Result<pii::SecretSerdeValue, Error> {- self.redirect_response- .as_ref()- .and_then(|res| res.payload.to_owned())- .ok_or(- errors::ConnectorError::MissingConnectorRedirectionPayload {- field_name: "request.redirect_response.payload".into(),- }- .into(),- )- }- fn connector_mandate_id(&self) -> Option<String> {- self.mandate_id- .as_ref()- .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id {- Some(mandates::MandateReferenceId::ConnectorMandateId(connector_mandate_ids)) => {- connector_mandate_ids.get_connector_mandate_id()- }- Some(mandates::MandateReferenceId::NetworkMandateId(_))- | Some(mandates::MandateReferenceId::CardWithLimitedData(_))- | None- | Some(mandates::MandateReferenceId::NetworkTokenWithNTI(_)) => None,- })- }-}-pub trait PaymentsCaptureRequestData {fn is_multiple_capture(&self) -> bool;fn get_browser_info(&self) -> Result<BrowserInformation, Error>;diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex 35bb57a18b..af96906a5f 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -7482,120 +7482,6 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::CompleteAuthoriz}}-#[cfg(feature = "v2")]-impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsPreProcessingData {- type Error = error_stack::Report<errors::ApiErrorResponse>;-- fn try_from(additional_data: PaymentAdditionalData<'_, F>) -> Result<Self, Self::Error> {- todo!()- }-}--#[cfg(feature = "v1")]-impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsPreProcessingData {- type Error = error_stack::Report<errors::ApiErrorResponse>;-- fn try_from(additional_data: PaymentAdditionalData<'_, F>) -> Result<Self, Self::Error> {- let payment_data = additional_data.payment_data;- let payment_method_data = payment_data.payment_method_data;- let router_base_url = &additional_data.router_base_url;- let attempt = &payment_data.payment_attempt;- let connector_name = &additional_data.connector_name;-- let order_details = payment_data- .payment_intent- .order_details- .map(|order_details| {- order_details- .iter()- .map(|data| {- data.to_owned()- .parse_value("OrderDetailsWithAmount")- .change_context(errors::ApiErrorResponse::InvalidDataValue {- field_name: "OrderDetailsWithAmount".into(),- })- .attach_printable("Unable to parse OrderDetailsWithAmount")- })- .collect::<Result<Vec<_>, _>>()- })- .transpose()?;- let merchant_connector_account_id_or_connector_name = payment_data- .payment_attempt- .merchant_connector_id- .as_ref()- .map(|mca_id| mca_id.get_string_repr())- .unwrap_or(connector_name);- let webhook_url = Some(helpers::create_webhook_url(- router_base_url,- &attempt.processor_merchant_id,- merchant_connector_account_id_or_connector_name,- ));- let router_return_url = Some(helpers::create_redirect_url(- router_base_url,- attempt,- connector_name,- payment_data.creds_identifier.as_deref(),- ));- let complete_authorize_url = Some(helpers::create_complete_authorize_url(- router_base_url,- attempt,- connector_name,- payment_data.creds_identifier.as_deref(),- ));- let browser_info: Option<types::BrowserInformation> = payment_data- .payment_attempt- .browser_info- .clone()- .map(|b| b.parse_value("BrowserInformation"))- .transpose()- .change_context(errors::ApiErrorResponse::InvalidDataValue {- field_name: "browser_info".into(),- })?;- let device_channel = Some(types::BrowserInformation::resolve_device_channel(- browser_info.as_ref(),- ));- let amount = payment_data.payment_attempt.get_total_amount();- Ok(Self {- payment_method_data,- email: additional_data.customer_data.and_then(|cust| cust.email),- currency: Some(payment_data.currency),- amount: amount.get_amount_as_i64(), // need to change this once we move to connector module- minor_amount: amount,- payment_method_type: payment_data.payment_attempt.payment_method_type,- setup_mandate_details: payment_data.setup_mandate,- capture_method: payment_data.payment_attempt.capture_method,- order_details,- router_return_url,- webhook_url,- complete_authorize_url,- browser_info,- device_channel,- surcharge_details: payment_data.surcharge_details,- connector_transaction_id: payment_data- .payment_attempt- .get_connector_payment_id()- .map(ToString::to_string),- redirect_response: None,- mandate_id: payment_data.mandate_id,- related_transaction_id: None,- enrolled_for_3ds: true,- split_payments: payment_data.payment_intent.split_payments,- metadata: payment_data.payment_intent.metadata.map(Secret::new),- customer_acceptance: payment_data.customer_acceptance,- setup_future_usage: payment_data- .payment_attempt- .setup_future_usage_applied- .or(payment_data.payment_intent.setup_future_usage),- is_stored_credential: payment_data.payment_attempt.is_stored_credential,- force_3ds_challenge: payment_data- .payment_intent- .force_3ds_challenge_trigger- .filter(|trigger| *trigger)- .or(payment_data.payment_intent.force_3ds_challenge),- })- }-}-impl ForeignFrom<payments::FraudCheck> for FrmMessage {fn foreign_from(fraud_check: payments::FraudCheck) -> Self {Self {diff --git a/crates/router/src/types.rs b/crates/router/src/types.rsindex 803506628d..e191770ec1 100644--- a/crates/router/src/types.rs+++ b/crates/router/src/types.rs@@ -43,8 +43,8 @@ use hyperswitch_domain_models::router_flow_types::{Capture, CompleteAuthorize, CompleteRefundSurchrge, CompleteSurcharge,CreateConnectorCustomer, CreateOrder, ExtendAuthorization, ExternalVaultProxy, GenerateQr,IncrementalAuthorization, InitPayment, PSync, PostCaptureVoid, PostCaptureVoidSync,- PostProcessing, PostSessionTokens, PreAuthorizeVoid, PreProcessing, PushNotification,- Reject, SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, UpdatePostConfirm, Void,+ PostProcessing, PostSessionTokens, PreAuthorizeVoid, PushNotification, Reject,+ SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, UpdatePostConfirm, Void,},refunds::{Execute, RSync},webhooks::VerifyWebhookSource,@@ -87,13 +87,13 @@ pub use hyperswitch_domain_models::{PaymentsCompleteRefundSurchrgeData, PaymentsCompleteSurchargeData,PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,- PaymentsPreAuthenticateData, PaymentsPreAuthorizeCancelData, PaymentsPreProcessingData,- PaymentsRejectData, PaymentsSessionData, PaymentsSurchargeCalculationData,- PaymentsSyncData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData,- PaymentsUpdatePostConfirmData, PushNotificationRequestData, RefundsData, ResponseId,- RetrieveFileRequestData, SdkPaymentsSessionUpdateData, SetupMandateRequestData,- SplitRefundsRequest, SubmitEvidenceRequestData, SyncRequestType, UploadFileRequestData,- VaultRequestData, VerifyWebhookSourceRequestData,+ PaymentsPreAuthenticateData, PaymentsPreAuthorizeCancelData, PaymentsRejectData,+ PaymentsSessionData, PaymentsSurchargeCalculationData, PaymentsSyncData,+ PaymentsTaxCalculationData, PaymentsUpdateMetadataData, PaymentsUpdatePostConfirmData,+ PushNotificationRequestData, RefundsData, ResponseId, RetrieveFileRequestData,+ SdkPaymentsSessionUpdateData, SetupMandateRequestData, SplitRefundsRequest,+ SubmitEvidenceRequestData, SyncRequestType, UploadFileRequestData, VaultRequestData,+ VerifyWebhookSourceRequestData,},router_response_types::{merchant_connector_webhook_management::{@@ -128,11 +128,11 @@ pub use hyperswitch_interfaces::{IncrementalAuthorizationType, MandateRevokeType, PaymentsAuthorizeType,PaymentsBalanceType, PaymentsCaptureType, PaymentsCompleteAuthorizeType, PaymentsInitType,PaymentsPostCaptureVoidType, PaymentsPostProcessingType, PaymentsPostSessionTokensType,- PaymentsPreAuthorizeType, PaymentsPreProcessingType, PaymentsPushNotificationType,- PaymentsSessionType, PaymentsSyncType, PaymentsUpdateMetadataType, PaymentsVoidType,- RefreshTokenType, RefundExecuteType, RefundSyncType, Response, RetrieveFileType,- SdkSessionUpdateType, SetupMandateType, SubmitEvidenceType, TokenizationType,- UploadFileType, VerifyWebhookSourceType,+ PaymentsPreAuthorizeType, PaymentsPushNotificationType, PaymentsSessionType,+ PaymentsSyncType, PaymentsUpdateMetadataType, PaymentsVoidType, RefreshTokenType,+ RefundExecuteType, RefundSyncType, Response, RetrieveFileType, SdkSessionUpdateType,+ SetupMandateType, SubmitEvidenceType, TokenizationType, UploadFileType,+ VerifyWebhookSourceType,},};@@ -150,8 +150,6 @@ pub type PaymentsAuthorizeRouterData =RouterData<Authorize, PaymentsAuthorizeData, PaymentsResponseData>;pub type ExternalVaultProxyPaymentsRouterData =RouterData<ExternalVaultProxy, ExternalVaultProxyPaymentsData, PaymentsResponseData>;-pub type PaymentsPreProcessingRouterData =- RouterData<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>;pub type PaymentsPushNotificationRouterData =RouterData<PushNotification, PushNotificationRequestData, PaymentsResponseData>;pub type PaymentsGenerateQrRouterData =@@ -258,8 +256,6 @@ pub type SdkSessionUpdateResponseRouterData<R> =ResponseRouterData<SdkSessionUpdate, R, SdkPaymentsSessionUpdateData, PaymentsResponseData>;pub type PaymentsCaptureResponseRouterData<R> =ResponseRouterData<Capture, R, PaymentsCaptureData, PaymentsResponseData>;-pub type PaymentsPreprocessingResponseRouterData<R> =- ResponseRouterData<PreProcessing, R, PaymentsPreProcessingData, PaymentsResponseData>;pub type TokenizationResponseRouterData<R> =ResponseRouterData<PaymentMethodToken, R, PaymentMethodTokenizationData, PaymentsResponseData>;pub type ConnectorCustomerResponseRouterData<R> =diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rsindex e0633ce0ce..5dd37fe510 100644--- a/crates/router/src/types/api/payments.rs+++ b/crates/router/src/types/api/payments.rs@@ -44,8 +44,8 @@ pub use hyperswitch_domain_models::router_flow_types::payments::{CreateConnectorCustomer, CreateOrder, ExtendAuthorization, ExternalVaultProxy, GenerateQr,IncrementalAuthorization, InitPayment, PSync, PaymentCreateIntent, PaymentGetIntent,PaymentMethodToken, PaymentUpdateIntent, PostCaptureVoid, PostCaptureVoidSync, PostProcessing,- PostSessionTokens, PreAuthorizeVoid, PreProcessing, PushNotification, RecordAttempt, Reject,- SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, UpdatePostConfirm, Void,+ PostSessionTokens, PreAuthorizeVoid, PushNotification, RecordAttempt, Reject, SdkSessionUpdate,+ Session, SetupMandate, UpdateMetadata, UpdatePostConfirm, Void,};pub use hyperswitch_interfaces::api::payments::{ConnectorCustomer, MandateSetup, Payment, PaymentApprove, PaymentAuthorize,@@ -53,8 +53,8 @@ pub use hyperswitch_interfaces::api::payments::{PaymentPostCaptureVoid, PaymentPostCaptureVoidSync, PaymentPostSessionTokens, PaymentReject,PaymentSession, PaymentSessionUpdate, PaymentSync, PaymentToken, PaymentUpdate,PaymentUpdateMetadata, PaymentVoid, PaymentsCompleteAuthorize, PaymentsCreateOrder,- PaymentsGenerateQr, PaymentsPostProcessing, PaymentsPreProcessing, PaymentsPushNotification,- SurchargeCalculation, SurchargeComplete, SurchargeRefund, TaxCalculation,+ PaymentsGenerateQr, PaymentsPostProcessing, PaymentsPushNotification, SurchargeCalculation,+ SurchargeComplete, SurchargeRefund, TaxCalculation,};pub use mandates::MandateTransactionType;@@ -65,7 +65,7 @@ pub use super::payments_v2::{PaymentPostSessionTokensV2, PaymentRejectV2, PaymentSessionUpdateV2, PaymentSessionV2,PaymentSyncV2, PaymentTokenV2, PaymentUpdateMetadataV2, PaymentV2, PaymentVoidV2,PaymentsCompleteAuthorizeV2, PaymentsGenerateQrV2, PaymentsPostProcessingV2,- PaymentsPreProcessingV2, PaymentsPushNotificationV2, TaxCalculationV2,+ PaymentsPushNotificationV2, TaxCalculationV2,};use crate::core::errors;diff --git a/crates/router/src/types/api/payments_v2.rs b/crates/router/src/types/api/payments_v2.rsindex c2d90bdaec..fd7eb17dcb 100644--- a/crates/router/src/types/api/payments_v2.rs+++ b/crates/router/src/types/api/payments_v2.rs@@ -5,5 +5,5 @@ pub use hyperswitch_interfaces::api::payments_v2::{PaymentPostSessionTokensV2, PaymentRejectV2, PaymentSessionUpdateV2, PaymentSessionV2,PaymentSyncV2, PaymentTokenV2, PaymentUpdateMetadataV2, PaymentV2, PaymentVoidV2,PaymentsCompleteAuthorizeV2, PaymentsGenerateQrV2, PaymentsPostProcessingV2,- PaymentsPreProcessingV2, PaymentsPushNotificationV2, TaxCalculationV2,+ PaymentsPushNotificationV2, TaxCalculationV2,};