From 724179afa8e83d42a5a55ede6ebe083cf30a3bf3 Mon Sep 17 00:00:00 2001 From: swangi-kumari Date: Thu, 19 Dec 2024 15:49:09 +0530 Subject: [PATCH] refactor: remove merchant return url from router_data --- .../src/connectors/bitpay/transformers.rs | 2 +- .../src/connectors/boku/transformers.rs | 3 ++- .../src/connectors/coinbase/transformers.rs | 4 +-- .../src/connectors/mollie/transformers.rs | 2 +- .../src/connectors/novalnet/transformers.rs | 2 +- .../src/connectors/rapyd/transformers.rs | 2 +- .../src/connectors/zen/transformers.rs | 2 +- crates/hyperswitch_connectors/src/utils.rs | 12 --------- .../src/router_data.rs | 1 - .../src/router_data_v2/flow_common_types.rs | 6 ----- .../src/connector/adyen/transformers.rs | 18 ++++++------- .../src/connector/iatapay/transformers.rs | 6 ++--- .../src/connector/nuvei/transformers.rs | 6 ++--- .../src/connector/opennode/transformers.rs | 2 +- .../src/connector/payme/transformers.rs | 4 +-- .../src/connector/paypal/transformers.rs | 1 - .../src/connector/stripe/transformers.rs | 2 +- .../src/connector/trustpay/transformers.rs | 4 +-- crates/router/src/connector/utils.rs | 16 ++---------- .../src/core/authentication/transformers.rs | 1 - .../core/fraud_check/flows/checkout_flow.rs | 1 - .../fraud_check/flows/fulfillment_flow.rs | 1 - .../core/fraud_check/flows/record_return.rs | 1 - .../src/core/fraud_check/flows/sale_flow.rs | 1 - .../fraud_check/flows/transaction_flow.rs | 1 - crates/router/src/core/mandate/utils.rs | 1 - crates/router/src/core/payments/helpers.rs | 1 - .../payments/operations/payment_response.rs | 2 +- .../router/src/core/payments/transformers.rs | 25 ------------------- .../unified_authentication_service/utils.rs | 1 - crates/router/src/core/utils.rs | 8 ------ crates/router/src/core/webhooks/utils.rs | 1 - .../router/src/services/conversion_impls.rs | 19 -------------- crates/router/src/types.rs | 2 -- .../router/src/types/api/verify_connector.rs | 1 - crates/router/tests/connectors/aci.rs | 2 -- crates/router/tests/connectors/cashtocode.rs | 1 - crates/router/tests/connectors/cryptopay.rs | 1 - crates/router/tests/connectors/iatapay.rs | 1 - crates/router/tests/connectors/opennode.rs | 1 - crates/router/tests/connectors/payme.rs | 1 - crates/router/tests/connectors/square.rs | 1 - crates/router/tests/connectors/stax.rs | 1 - crates/router/tests/connectors/utils.rs | 2 -- 44 files changed, 32 insertions(+), 141 deletions(-) diff --git a/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs index 333398dfa90a..4071b58a880b 100644 --- a/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs @@ -267,7 +267,7 @@ fn get_crypto_specific_payment_data( ) -> Result> { let price = item.amount; let currency = item.router_data.request.currency.to_string(); - let redirect_url = item.router_data.request.get_return_url()?; + let redirect_url = item.router_data.request.get_router_return_url()?; let notification_url = item.router_data.request.get_webhook_url()?; let transaction_speed = TransactionSpeed::Medium; let auth_type = item.router_data.connector_auth_type.clone(); diff --git a/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs b/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs index df1331750378..da5f775489c3 100644 --- a/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs @@ -499,7 +499,8 @@ pub struct BokuErrorResponse { } fn get_hosted_data(item: &types::PaymentsAuthorizeRouterData) -> Option { - item.return_url + item.request + .router_return_url .clone() .map(|url| BokuHostedData { forward_url: url }) } diff --git a/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs b/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs index 41a5306527cf..8ac5f86247ca 100644 --- a/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs @@ -278,8 +278,8 @@ fn get_crypto_specific_payment_data( })?; let pricing_type = connector_meta.pricing_type; let local_price = get_local_price(item); - let redirect_url = item.request.get_return_url()?; - let cancel_url = item.request.get_return_url()?; + let redirect_url = item.request.get_router_return_url()?; + let cancel_url = item.request.get_router_return_url()?; Ok(CoinbasePaymentsRequest { name, diff --git a/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs b/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs index 5257df672f40..5a641327c96e 100644 --- a/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs @@ -152,7 +152,7 @@ impl TryFrom<&MollieRouterData<&types::PaymentsAuthorizeRouterData>> for MollieP value: item.amount.clone(), }; let description = item.router_data.get_description()?; - let redirect_url = item.router_data.request.get_return_url()?; + let redirect_url = item.router_data.request.get_router_return_url()?; let payment_method_data = match item.router_data.request.capture_method.unwrap_or_default() { enums::CaptureMethod::Automatic | enums::CaptureMethod::SequentialAutomatic => { diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs index 18783c64a016..0a70393a13cd 100644 --- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs @@ -207,7 +207,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym .unwrap_or(consts::DEFAULT_LOCALE.to_string().to_string()); let custom = NovalnetCustom { lang }; let hook_url = item.router_data.request.get_webhook_url()?; - let return_url = item.router_data.request.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; let create_token = if item.router_data.request.is_mandate_payment() { Some(1) } else { diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs index 23f861bfa3ac..778fe31978c0 100644 --- a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs @@ -162,7 +162,7 @@ impl TryFrom<&RapydRouterData<&types::PaymentsAuthorizeRouterData>> for RapydPay .change_context(errors::ConnectorError::NotImplemented( "payment_method".to_owned(), ))?; - let return_url = item.router_data.request.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; Ok(Self { amount: item.amount, currency: item.router_data.request.currency, diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs index 7a30a434a5d7..8652b60635bb 100644 --- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs @@ -523,7 +523,7 @@ impl amount, terminal_uuid: Secret::new(terminal_uuid), signature: None, - url_redirect: item.router_data.request.get_return_url()?, + url_redirect: item.router_data.request.get_router_return_url()?, }; checkout_request.signature = Some(get_checkout_signature(&checkout_request, &session_data)?); diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs index 6dce48e69965..d8dd6dd50b1d 100644 --- a/crates/hyperswitch_connectors/src/utils.rs +++ b/crates/hyperswitch_connectors/src/utils.rs @@ -358,7 +358,6 @@ pub trait RouterData { fn get_billing_country(&self) -> Result; fn get_billing_phone(&self) -> Result<&PhoneDetails, Error>; fn get_description(&self) -> Result; - fn get_return_url(&self) -> Result; fn get_billing_address(&self) -> Result<&AddressDetails, Error>; fn get_shipping_address(&self) -> Result<&AddressDetails, Error>; fn get_shipping_address_with_phone_number(&self) -> Result<&Address, Error>; @@ -547,11 +546,6 @@ impl RouterData .clone() .ok_or_else(missing_field_err("description")) } - fn get_return_url(&self) -> Result { - self.return_url - .clone() - .ok_or_else(missing_field_err("return_url")) - } fn get_billing_address(&self) -> Result<&AddressDetails, Error> { self.address .get_payment_method_billing() @@ -1261,7 +1255,6 @@ pub trait PaymentsAuthorizeRequestData { fn get_browser_info(&self) -> Result; fn get_order_details(&self) -> Result, Error>; fn get_card(&self) -> Result; - fn get_return_url(&self) -> Result; fn connector_mandate_id(&self) -> Option; fn is_mandate_payment(&self) -> bool; fn is_customer_initiated_mandate_payment(&self) -> bool; @@ -1324,11 +1317,6 @@ impl PaymentsAuthorizeRequestData for PaymentsAuthorizeData { _ => Err(missing_field_err("card")()), } } - fn get_return_url(&self) -> Result { - self.router_return_url - .clone() - .ok_or_else(missing_field_err("return_url")) - } fn get_complete_authorize_url(&self) -> Result { self.complete_authorize_url diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs index b070c6bc848a..b3590ee6b2a8 100644 --- a/crates/hyperswitch_domain_models/src/router_data.rs +++ b/crates/hyperswitch_domain_models/src/router_data.rs @@ -26,7 +26,6 @@ pub struct RouterData { pub payment_method: common_enums::enums::PaymentMethod, pub connector_auth_type: ConnectorAuthType, pub description: Option, - pub return_url: Option, pub address: PaymentAddress, pub auth_type: common_enums::enums::AuthenticationType, pub connector_meta_data: Option, diff --git a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs index 85028a3bd7fa..47b2134bc19f 100644 --- a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs +++ b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs @@ -19,7 +19,6 @@ pub struct PaymentFlowData { pub status: common_enums::AttemptStatus, pub payment_method: common_enums::PaymentMethod, pub description: Option, - pub return_url: Option, pub address: PaymentAddress, pub auth_type: common_enums::AuthenticationType, pub connector_meta_data: Option, @@ -59,7 +58,6 @@ pub struct RefundFlowData { pub attempt_id: String, pub status: common_enums::AttemptStatus, pub payment_method: common_enums::PaymentMethod, - pub return_url: Option, pub connector_meta_data: Option, pub amount_captured: Option, // minor amount for amount framework @@ -75,7 +73,6 @@ pub struct PayoutFlowData { pub merchant_id: common_utils::id_type::MerchantId, pub customer_id: Option, pub connector_customer: Option, - pub return_url: Option, pub address: PaymentAddress, pub connector_meta_data: Option, pub connector_wallets_details: Option, @@ -93,7 +90,6 @@ pub struct FrmFlowData { pub attempt_id: String, pub payment_method: common_enums::enums::PaymentMethod, pub connector_request_reference_id: String, - pub return_url: Option, pub auth_type: common_enums::enums::AuthenticationType, pub connector_wallets_details: Option, pub connector_meta_data: Option, @@ -115,7 +111,6 @@ pub struct DisputesFlowData { pub payment_id: String, pub attempt_id: String, pub payment_method: common_enums::enums::PaymentMethod, - pub return_url: Option, pub connector_meta_data: Option, pub amount_captured: Option, // minor amount for amount framework @@ -145,7 +140,6 @@ pub struct FilesFlowData { pub merchant_id: common_utils::id_type::MerchantId, pub payment_id: String, pub attempt_id: String, - pub return_url: Option, pub connector_meta_data: Option, pub connector_request_reference_id: String, } diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs index d0dad91f7170..789c105d9b90 100644 --- a/crates/router/src/connector/adyen/transformers.rs +++ b/crates/router/src/connector/adyen/transformers.rs @@ -2628,7 +2628,7 @@ impl get_recurring_processing_model(item.router_data)?; let browser_info = None; let additional_data = get_additional_data(item.router_data); - let return_url = item.router_data.request.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; let payment_method_type = item.router_data.request.payment_method_type; let payment_method = match mandate_ref_id { payments::MandateReferenceId::ConnectorMandateId(connector_mandate_ids) => { @@ -2811,7 +2811,7 @@ impl get_address_info(item.router_data.get_optional_billing()).and_then(Result::ok); let country_code = get_country_code(item.router_data.get_optional_billing()); let additional_data = get_additional_data(item.router_data); - let return_url = item.router_data.request.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; let card_holder_name = item.router_data.get_optional_billing_full_name(); let payment_method = AdyenPaymentMethod::try_from((card_data, card_holder_name))?; let shopper_email = item.router_data.get_optional_billing_email(); @@ -2870,7 +2870,7 @@ impl get_recurring_processing_model(item.router_data)?; let browser_info = get_browser_info(item.router_data)?; let additional_data = get_additional_data(item.router_data); - let return_url = item.router_data.request.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; let payment_method = AdyenPaymentMethod::try_from((bank_debit_data, item.router_data))?; let country_code = get_country_code(item.router_data.get_optional_billing()); let request = AdyenPaymentRequest { @@ -2927,7 +2927,7 @@ impl let browser_info = get_browser_info(item.router_data)?; let additional_data = get_additional_data(item.router_data); let payment_method = AdyenPaymentMethod::try_from((voucher_data, item.router_data))?; - let return_url = item.router_data.request.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; let social_security_number = get_social_security_number(voucher_data); let billing_address = get_address_info(item.router_data.get_optional_billing()).and_then(Result::ok); @@ -2984,7 +2984,7 @@ impl let auth_type = AdyenAuthType::try_from(&item.router_data.connector_auth_type)?; let shopper_interaction = AdyenShopperInteraction::from(item.router_data); let payment_method = AdyenPaymentMethod::try_from((bank_transfer_data, item.router_data))?; - let return_url = item.router_data.request.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; let request = AdyenPaymentRequest { amount, merchant_account: auth_type.merchant_account, @@ -3090,7 +3090,7 @@ impl get_recurring_processing_model(item.router_data)?; let browser_info = get_browser_info(item.router_data)?; let additional_data = get_additional_data(item.router_data); - let return_url = item.router_data.request.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; let payment_method = AdyenPaymentMethod::try_from(( bank_redirect_data, item.router_data.test_mode, @@ -3275,7 +3275,7 @@ impl ); let (recurring_processing_model, store_payment_method, _) = get_recurring_processing_model(item.router_data)?; - let return_url = item.router_data.request.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; let shopper_name = get_shopper_name(item.router_data.get_optional_billing()); let shopper_email = item.router_data.get_optional_billing_email(); let billing_address = @@ -3343,7 +3343,7 @@ impl let auth_type = AdyenAuthType::try_from(&item.router_data.connector_auth_type)?; let payment_method = AdyenPaymentMethod::try_from(card_redirect_data)?; let shopper_interaction = AdyenShopperInteraction::from(item.router_data); - let return_url = item.router_data.request.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; let shopper_name = get_shopper_name(item.router_data.get_optional_billing()); let shopper_email = item.router_data.get_optional_billing_email(); let telephone_number = item @@ -5443,7 +5443,7 @@ impl get_address_info(item.router_data.get_optional_billing()).transpose()?; let country_code = get_country_code(item.router_data.get_optional_billing()); let additional_data = get_additional_data(item.router_data); - let return_url = item.router_data.request.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; let card_holder_name = item.router_data.get_optional_billing_full_name(); let payment_method = AdyenPaymentMethod::try_from((token_data, card_holder_name))?; let shopper_email = item.router_data.request.email.clone(); diff --git a/crates/router/src/connector/iatapay/transformers.rs b/crates/router/src/connector/iatapay/transformers.rs index fa5528eace3a..641505780b46 100644 --- a/crates/router/src/connector/iatapay/transformers.rs +++ b/crates/router/src/connector/iatapay/transformers.rs @@ -6,9 +6,7 @@ use masking::{Secret, SwitchStrategy}; use serde::{Deserialize, Serialize}; use crate::{ - connector::utils::{ - self as connector_util, PaymentsAuthorizeRequestData, RefundsRequestData, RouterData, - }, + connector::utils::{self as connector_util, PaymentsAuthorizeRequestData, RefundsRequestData}, consts, core::errors, services, @@ -128,7 +126,7 @@ impl >, >, ) -> Result { - let return_url = item.router_data.get_return_url()?; + let return_url = item.router_data.request.get_router_return_url()?; // Iatapay processes transactions through the payment method selected based on the country let (country, payer_info, preferred_checkout_method) = match item.router_data.request.payment_method_data.clone() { diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs index 121ec1d7b7ce..9c44727fc82a 100644 --- a/crates/router/src/connector/nuvei/transformers.rs +++ b/crates/router/src/connector/nuvei/transformers.rs @@ -71,7 +71,7 @@ impl NuveiAuthorizePreprocessingCommon for types::PaymentsAuthorizeData { fn get_return_url_required( &self, ) -> Result> { - self.get_return_url() + self.get_router_return_url() } fn get_capture_method(&self) -> Option { @@ -122,7 +122,7 @@ impl NuveiAuthorizePreprocessingCommon for types::PaymentsPreProcessingData { fn get_return_url_required( &self, ) -> Result> { - self.get_return_url() + self.get_router_return_url() } fn get_capture_method(&self) -> Option { @@ -1129,7 +1129,7 @@ where browser_details, v2_additional_params: additional_params, notification_url: item.request.get_complete_authorize_url().clone(), - merchant_url: item.return_url.clone(), + merchant_url: Some(item.request.get_return_url_required()?), platform_type: Some(PlatformType::Browser), method_completion_ind: Some(MethodCompletion::Unavailable), ..Default::default() diff --git a/crates/router/src/connector/opennode/transformers.rs b/crates/router/src/connector/opennode/transformers.rs index 1e8239d377bb..44315ac42fa8 100644 --- a/crates/router/src/connector/opennode/transformers.rs +++ b/crates/router/src/connector/opennode/transformers.rs @@ -258,7 +258,7 @@ fn get_crypto_specific_payment_data( let currency = item.router_data.request.currency.to_string(); let description = item.router_data.get_description()?; let auto_settle = true; - let success_url = item.router_data.get_return_url()?; + let success_url = item.router_data.request.get_router_return_url()?; let callback_url = item.router_data.request.get_webhook_url()?; let order_id = item.router_data.connector_request_reference_id.clone(); diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs index 7b6b67c8408e..47cbd017b16f 100644 --- a/crates/router/src/connector/payme/transformers.rs +++ b/crates/router/src/connector/payme/transformers.rs @@ -375,7 +375,7 @@ impl TryFrom<&PaymeRouterData<&types::PaymentsPreProcessingRouterData>> for Gene 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_return_url()?, + 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, @@ -634,7 +634,7 @@ impl TryFrom<&PaymeRouterData<&types::PaymentsAuthorizeRouterData>> for MandateR sale_price: item.amount.to_owned(), transaction_id: item.router_data.payment_id.clone(), product_name, - sale_return_url: item.router_data.request.get_return_url()?, + sale_return_url: item.router_data.request.get_router_return_url()?, seller_payme_id, sale_callback_url: item.router_data.request.get_webhook_url()?, buyer_key: Secret::new(item.router_data.request.get_connector_mandate_id()?), diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs index 11e01b78e134..e2527e5a1786 100644 --- a/crates/router/src/connector/paypal/transformers.rs +++ b/crates/router/src/connector/paypal/transformers.rs @@ -597,7 +597,6 @@ impl }; Ok(Self { status, - return_url: None, response: Ok(types::PaymentsResponseData::TransactionResponse { resource_id: types::ResponseId::ConnectorTransactionId(info_response.id.clone()), redirection_data: Box::new(None), diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs index 2f0b0e0316fd..c6408af3bb8d 100644 --- a/crates/router/src/connector/stripe/transformers.rs +++ b/crates/router/src/connector/stripe/transformers.rs @@ -3352,7 +3352,7 @@ impl email: item.get_billing_email().or(item.request.get_email())?, }, amount: Some(amount), - return_url: Some(item.get_return_url()?), + return_url: Some(item.request.get_router_return_url()?), }), ), domain::BankTransferData::AchBankTransfer { .. } => { diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs index dafca256529e..e6f4aaf7d25e 100644 --- a/crates/router/src/connector/trustpay/transformers.rs +++ b/crates/router/src/connector/trustpay/transformers.rs @@ -350,7 +350,7 @@ fn get_bank_redirection_request_data( auth: TrustpayAuthType, ) -> Result> { let pm = TrustpayPaymentMethod::try_from(bank_redirection_data)?; - let return_url = item.request.get_return_url()?; + let return_url = item.request.get_router_return_url()?; let payment_request = TrustpayPaymentsRequest::BankRedirectPaymentRequest(Box::new(PaymentRequestBankRedirect { payment_method: pm.clone(), @@ -410,7 +410,7 @@ impl TryFrom<&TrustpayRouterData<&types::PaymentsAuthorizeRouterData>> for Trust params, amount, ccard, - item.router_data.request.get_return_url()?, + item.router_data.request.get_router_return_url()?, )?), domain::PaymentMethodData::BankRedirect(ref bank_redirection_data) => { get_bank_redirection_request_data( diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs index 1ea7565f69fe..bccbe6f4c923 100644 --- a/crates/router/src/connector/utils.rs +++ b/crates/router/src/connector/utils.rs @@ -84,7 +84,6 @@ pub trait RouterData { fn get_billing_phone(&self) -> Result<&hyperswitch_domain_models::address::PhoneDetails, Error>; fn get_description(&self) -> Result; - fn get_return_url(&self) -> Result; fn get_billing_address( &self, ) -> Result<&hyperswitch_domain_models::address::AddressDetails, Error>; @@ -321,11 +320,6 @@ impl RouterData for types::RouterData Result { - self.return_url - .clone() - .ok_or_else(missing_field_err("return_url")) - } fn get_billing_address( &self, ) -> Result<&hyperswitch_domain_models::address::AddressDetails, Error> { @@ -653,7 +647,7 @@ pub trait PaymentsPreProcessingData { fn is_auto_capture(&self) -> Result; fn get_order_details(&self) -> Result, Error>; fn get_webhook_url(&self) -> Result; - fn get_return_url(&self) -> Result; + fn get_router_return_url(&self) -> Result; fn get_browser_info(&self) -> Result; fn get_complete_authorize_url(&self) -> Result; fn connector_mandate_id(&self) -> Option; @@ -699,7 +693,7 @@ impl PaymentsPreProcessingData for types::PaymentsPreProcessingData { .clone() .ok_or_else(missing_field_err("webhook_url")) } - fn get_return_url(&self) -> Result { + fn get_router_return_url(&self) -> Result { self.router_return_url .clone() .ok_or_else(missing_field_err("return_url")) @@ -797,7 +791,6 @@ pub trait PaymentsAuthorizeRequestData { fn get_browser_info(&self) -> Result; fn get_order_details(&self) -> Result, Error>; fn get_card(&self) -> Result; - fn get_return_url(&self) -> Result; fn connector_mandate_id(&self) -> Option; fn get_optional_network_transaction_id(&self) -> Option; fn is_mandate_payment(&self) -> bool; @@ -865,11 +858,6 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData { _ => Err(missing_field_err("card")()), } } - fn get_return_url(&self) -> Result { - self.router_return_url - .clone() - .ok_or_else(missing_field_err("return_url")) - } fn get_complete_authorize_url(&self) -> Result { self.complete_authorize_url diff --git a/crates/router/src/core/authentication/transformers.rs b/crates/router/src/core/authentication/transformers.rs index da6252d54292..30373d1408f5 100644 --- a/crates/router/src/core/authentication/transformers.rs +++ b/crates/router/src/core/authentication/transformers.rs @@ -154,7 +154,6 @@ pub fn construct_router_data( payment_method, connector_auth_type: auth_type, description: None, - return_url: None, address, auth_type: common_enums::AuthenticationType::NoThreeDs, connector_meta_data: merchant_connector_account.get_metadata(), diff --git a/crates/router/src/core/fraud_check/flows/checkout_flow.rs b/crates/router/src/core/fraud_check/flows/checkout_flow.rs index b07268ae6668..c413208b2083 100644 --- a/crates/router/src/core/fraud_check/flows/checkout_flow.rs +++ b/crates/router/src/core/fraud_check/flows/checkout_flow.rs @@ -85,7 +85,6 @@ impl ConstructFlowSpecificData( payment_method, connector_auth_type: auth_type, description: None, - return_url: payment_intent.return_url.clone(), address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), connector_meta_data: merchant_connector_account.get_metadata(), diff --git a/crates/router/src/core/fraud_check/flows/record_return.rs b/crates/router/src/core/fraud_check/flows/record_return.rs index d05f7280024a..5e3540311854 100644 --- a/crates/router/src/core/fraud_check/flows/record_return.rs +++ b/crates/router/src/core/fraud_check/flows/record_return.rs @@ -80,7 +80,6 @@ impl ConstructFlowSpecificData( description: router_data.description, payment_id: router_data.payment_id, payment_method: router_data.payment_method, - return_url: router_data.return_url, status: router_data.status, attempt_id: router_data.attempt_id, access_token: router_data.access_token, diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs index 01a4e0860918..d04d743a39c8 100644 --- a/crates/router/src/core/payments/operations/payment_response.rs +++ b/crates/router/src/core/payments/operations/payment_response.rs @@ -1902,7 +1902,7 @@ async fn payment_response_update_tracker( status: api_models::enums::IntentStatus::foreign_from( payment_data.payment_attempt.status, ), - return_url: router_data.return_url.clone(), + return_url: None, amount_captured, updated_by: storage_scheme.to_string(), fingerprint_id: payment_data.payment_attempt.fingerprint_id.clone(), diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index 85bc51a09a7f..b73f3be61f20 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -126,7 +126,6 @@ where payment_method: diesel_models::enums::PaymentMethod::default(), connector_auth_type: auth_type, description: None, - return_url: None, address: payment_data.address.clone(), auth_type: payment_data .payment_attempt @@ -324,14 +323,6 @@ pub async fn construct_payment_router_data_for_authorize<'a>( .as_ref() .map(|description| description.get_string_repr()) .map(ToOwned::to_owned), - // TODO: evaluate why we need to send merchant's return url here - // This should be the return url of application, since application takes care of the redirection - return_url: payment_data - .payment_intent - .return_url - .as_ref() - .map(|description| description.get_string_repr()) - .map(ToOwned::to_owned), // TODO: Create unified address address: payment_data.payment_address.clone(), auth_type: payment_data.payment_attempt.authentication_type, @@ -459,13 +450,6 @@ pub async fn construct_router_data_for_psync<'a>( .as_ref() .map(|description| description.get_string_repr()) .map(ToOwned::to_owned), - // TODO: evaluate why we need to send merchant's return url here - // This should be the return url of application, since application takes care of the redirection - return_url: payment_intent - .return_url - .as_ref() - .map(|description| description.get_string_repr()) - .map(ToOwned::to_owned), // TODO: Create unified address address: hyperswitch_domain_models::payment_address::PaymentAddress::default(), auth_type: attempt.authentication_type, @@ -603,14 +587,6 @@ pub async fn construct_payment_router_data_for_sdk_session<'a>( .as_ref() .map(|description| description.get_string_repr()) .map(ToOwned::to_owned), - // TODO: evaluate why we need to send merchant's return url here - // This should be the return url of application, since application takes care of the redirection - return_url: payment_data - .payment_intent - .return_url - .as_ref() - .map(|description| description.get_string_repr()) - .map(ToOwned::to_owned), // TODO: Create unified address address: hyperswitch_domain_models::payment_address::PaymentAddress::default(), auth_type: payment_data.payment_intent.authentication_type, @@ -797,7 +773,6 @@ where payment_method, connector_auth_type: auth_type, description: payment_data.payment_intent.description.clone(), - return_url: payment_data.payment_intent.return_url.clone(), address: unified_address, auth_type: payment_data .payment_attempt diff --git a/crates/router/src/core/unified_authentication_service/utils.rs b/crates/router/src/core/unified_authentication_service/utils.rs index e0d10251049a..fe4f864604ea 100644 --- a/crates/router/src/core/unified_authentication_service/utils.rs +++ b/crates/router/src/core/unified_authentication_service/utils.rs @@ -130,7 +130,6 @@ pub fn construct_uas_router_data( payment_method, connector_auth_type: auth_type, description: None, - return_url: None, address: address.unwrap_or_default(), auth_type: common_enums::AuthenticationType::default(), connector_meta_data: merchant_connector_account.get_metadata(), diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs index 951d3c003fd2..c441e32581e8 100644 --- a/crates/router/src/core/utils.rs +++ b/crates/router/src/core/utils.rs @@ -162,7 +162,6 @@ pub async fn construct_payout_router_data<'a, F>( payment_method: enums::PaymentMethod::default(), connector_auth_type, description: None, - return_url: payouts.return_url.to_owned(), address, auth_type: enums::AuthenticationType::default(), connector_meta_data: merchant_connector_account.get_metadata(), @@ -338,7 +337,6 @@ pub async fn construct_refund_router_data<'a, F>( payment_method: payment_method_type, connector_auth_type: auth_type, description: None, - return_url: payment_intent.return_url.clone(), // Does refund need shipping/billing address ? address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), @@ -660,7 +658,6 @@ pub async fn construct_accept_dispute_router_data<'a>( payment_method, connector_auth_type: auth_type, description: None, - return_url: payment_intent.return_url.clone(), address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), connector_meta_data: merchant_connector_account.get_metadata(), @@ -761,7 +758,6 @@ pub async fn construct_submit_evidence_router_data<'a>( payment_method, connector_auth_type: auth_type, description: None, - return_url: payment_intent.return_url.clone(), address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), connector_meta_data: merchant_connector_account.get_metadata(), @@ -860,7 +856,6 @@ pub async fn construct_upload_file_router_data<'a>( payment_method, connector_auth_type: auth_type, description: None, - return_url: payment_intent.return_url.clone(), address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), connector_meta_data: merchant_connector_account.get_metadata(), @@ -987,7 +982,6 @@ pub async fn construct_payments_dynamic_tax_calculation_router_data<'a, F: Clone payment_method: diesel_models::enums::PaymentMethod::default(), connector_auth_type, description: None, - return_url: None, address: payment_data.address.clone(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), connector_meta_data: None, @@ -1087,7 +1081,6 @@ pub async fn construct_defend_dispute_router_data<'a>( payment_method, connector_auth_type: auth_type, description: None, - return_url: payment_intent.return_url.clone(), address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), connector_meta_data: merchant_connector_account.get_metadata(), @@ -1186,7 +1179,6 @@ pub async fn construct_retrieve_file_router_data<'a>( payment_method: diesel_models::enums::PaymentMethod::default(), connector_auth_type: auth_type, description: None, - return_url: None, address: PaymentAddress::default(), auth_type: diesel_models::enums::AuthenticationType::default(), connector_meta_data: merchant_connector_account.get_metadata(), diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rs index f86ed910e46a..b21ec0056c19 100644 --- a/crates/router/src/core/webhooks/utils.rs +++ b/crates/router/src/core/webhooks/utils.rs @@ -82,7 +82,6 @@ pub async fn construct_webhook_router_data<'a>( payment_method: diesel_models::enums::PaymentMethod::default(), connector_auth_type: auth_type, description: None, - return_url: None, address: PaymentAddress::default(), auth_type: diesel_models::enums::AuthenticationType::default(), connector_meta_data: None, diff --git a/crates/router/src/services/conversion_impls.rs b/crates/router/src/services/conversion_impls.rs index 3902ef624da2..9bb88cf4ecc0 100644 --- a/crates/router/src/services/conversion_impls.rs +++ b/crates/router/src/services/conversion_impls.rs @@ -41,7 +41,6 @@ fn get_default_router_data( payment_method: common_enums::PaymentMethod::default(), connector_auth_type: router_data::ConnectorAuthType::default(), description: None, - return_url: None, address: PaymentAddress::default(), auth_type: common_enums::AuthenticationType::default(), connector_meta_data: None, @@ -131,7 +130,6 @@ impl RouterDataConversion for PaymentF status: old_router_data.status, payment_method: old_router_data.payment_method, description: old_router_data.description.clone(), - return_url: old_router_data.return_url.clone(), address: old_router_data.address.clone(), auth_type: old_router_data.auth_type, connector_meta_data: old_router_data.connector_meta_data.clone(), @@ -177,7 +175,6 @@ impl RouterDataConversion for PaymentF status, payment_method, description, - return_url, address, auth_type, connector_meta_data, @@ -209,7 +206,6 @@ impl RouterDataConversion for PaymentF router_data.status = status; router_data.payment_method = payment_method; router_data.description = description; - router_data.return_url = return_url; router_data.address = address; router_data.auth_type = auth_type; router_data.connector_meta_data = connector_meta_data; @@ -248,7 +244,6 @@ impl RouterDataConversion for RefundFl attempt_id: old_router_data.attempt_id.clone(), status: old_router_data.status, payment_method: old_router_data.payment_method, - return_url: old_router_data.return_url.clone(), connector_meta_data: old_router_data.connector_meta_data.clone(), amount_captured: old_router_data.amount_captured, minor_amount_captured: old_router_data.minor_amount_captured, @@ -281,7 +276,6 @@ impl RouterDataConversion for RefundFl attempt_id, status, payment_method, - return_url, connector_meta_data, amount_captured, minor_amount_captured, @@ -296,7 +290,6 @@ impl RouterDataConversion for RefundFl router_data.attempt_id = attempt_id; router_data.status = status; router_data.payment_method = payment_method; - router_data.return_url = return_url; router_data.connector_meta_data = connector_meta_data; router_data.amount_captured = amount_captured; router_data.minor_amount_captured = minor_amount_captured; @@ -318,7 +311,6 @@ impl RouterDataConversion for Disputes payment_id: old_router_data.payment_id.clone(), attempt_id: old_router_data.attempt_id.clone(), payment_method: old_router_data.payment_method, - return_url: old_router_data.return_url.clone(), connector_meta_data: old_router_data.connector_meta_data.clone(), amount_captured: old_router_data.amount_captured, minor_amount_captured: old_router_data.minor_amount_captured, @@ -349,7 +341,6 @@ impl RouterDataConversion for Disputes payment_id, attempt_id, payment_method, - return_url, connector_meta_data, amount_captured, minor_amount_captured, @@ -365,7 +356,6 @@ impl RouterDataConversion for Disputes router_data.payment_id = payment_id; router_data.attempt_id = attempt_id; router_data.payment_method = payment_method; - router_data.return_url = return_url; router_data.connector_meta_data = connector_meta_data; router_data.amount_captured = amount_captured; router_data.minor_amount_captured = minor_amount_captured; @@ -389,7 +379,6 @@ impl RouterDataConversion for FrmFlowD attempt_id: old_router_data.attempt_id.clone(), payment_method: old_router_data.payment_method, connector_request_reference_id: old_router_data.connector_request_reference_id.clone(), - return_url: old_router_data.return_url.clone(), auth_type: old_router_data.auth_type, connector_wallets_details: old_router_data.connector_wallets_details.clone(), connector_meta_data: old_router_data.connector_meta_data.clone(), @@ -417,7 +406,6 @@ impl RouterDataConversion for FrmFlowD attempt_id, payment_method, connector_request_reference_id, - return_url, auth_type, connector_wallets_details, connector_meta_data, @@ -432,7 +420,6 @@ impl RouterDataConversion for FrmFlowD router_data.attempt_id = attempt_id; router_data.payment_method = payment_method; router_data.connector_request_reference_id = connector_request_reference_id; - router_data.return_url = return_url; router_data.auth_type = auth_type; router_data.connector_wallets_details = connector_wallets_details; router_data.connector_meta_data = connector_meta_data; @@ -454,7 +441,6 @@ impl RouterDataConversion for FilesFlo merchant_id: old_router_data.merchant_id.clone(), payment_id: old_router_data.payment_id.clone(), attempt_id: old_router_data.attempt_id.clone(), - return_url: old_router_data.return_url.clone(), connector_meta_data: old_router_data.connector_meta_data.clone(), connector_request_reference_id: old_router_data.connector_request_reference_id.clone(), }; @@ -477,7 +463,6 @@ impl RouterDataConversion for FilesFlo merchant_id, payment_id, attempt_id, - return_url, connector_meta_data, connector_request_reference_id, } = new_router_data.resource_common_data; @@ -486,7 +471,6 @@ impl RouterDataConversion for FilesFlo router_data.merchant_id = merchant_id; router_data.payment_id = payment_id; router_data.attempt_id = attempt_id; - router_data.return_url = return_url; router_data.connector_meta_data = connector_meta_data; router_data.connector_request_reference_id = connector_request_reference_id; @@ -596,7 +580,6 @@ impl RouterDataConversion for PayoutFl merchant_id: old_router_data.merchant_id.clone(), customer_id: old_router_data.customer_id.clone(), connector_customer: old_router_data.connector_customer.clone(), - return_url: old_router_data.return_url.clone(), address: old_router_data.address.clone(), connector_meta_data: old_router_data.connector_meta_data.clone(), connector_wallets_details: old_router_data.connector_wallets_details.clone(), @@ -623,7 +606,6 @@ impl RouterDataConversion for PayoutFl merchant_id, customer_id, connector_customer, - return_url, address, connector_meta_data, connector_wallets_details, @@ -636,7 +618,6 @@ impl RouterDataConversion for PayoutFl router_data.merchant_id = merchant_id; router_data.customer_id = customer_id; router_data.connector_customer = connector_customer; - router_data.return_url = return_url; router_data.address = address; router_data.connector_meta_data = connector_meta_data; router_data.connector_wallets_details = connector_wallets_details; diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs index 2ab433785160..86e7e3657047 100644 --- a/crates/router/src/types.rs +++ b/crates/router/src/types.rs @@ -917,7 +917,6 @@ impl ForeignFrom<(&RouterData, T2) payment_method: data.payment_method, connector_auth_type: data.connector_auth_type.clone(), description: data.description.clone(), - return_url: data.return_url.clone(), address: data.address.clone(), auth_type: data.auth_type, connector_meta_data: data.connector_meta_data.clone(), @@ -987,7 +986,6 @@ impl payment_method: data.payment_method, connector_auth_type: data.connector_auth_type.clone(), description: data.description.clone(), - return_url: data.return_url.clone(), address: data.address.clone(), auth_type: data.auth_type, connector_meta_data: data.connector_meta_data.clone(), diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs index 3bd318731313..f16413584abc 100644 --- a/crates/router/src/types/api/verify_connector.rs +++ b/crates/router/src/types/api/verify_connector.rs @@ -77,7 +77,6 @@ impl VerifyConnectorData { connector: self.connector.id().to_string(), auth_type: storage_enums::AuthenticationType::NoThreeDs, test_mode: None, - return_url: None, attempt_id: attempt_id.clone(), description: None, customer_id: None, diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs index e3fd2bc1ee9c..18e9c43ed6ac 100644 --- a/crates/router/tests/connectors/aci.rs +++ b/crates/router/tests/connectors/aci.rs @@ -35,7 +35,6 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData { payment_method: enums::PaymentMethod::Card, connector_auth_type: utils::to_connector_auth_type(auth.into()), description: Some("This is a test".to_string()), - return_url: None, payment_method_status: None, request: types::PaymentsAuthorizeData { amount: 1000, @@ -155,7 +154,6 @@ fn construct_refund_router_data() -> types::RefundsRouterData { auth_type: enums::AuthenticationType::NoThreeDs, connector_auth_type: utils::to_connector_auth_type(auth.into()), description: Some("This is a test".to_string()), - return_url: None, request: types::RefundsData { payment_amount: 1000, currency: enums::Currency::USD, diff --git a/crates/router/tests/connectors/cashtocode.rs b/crates/router/tests/connectors/cashtocode.rs index 50c93f05a6b8..84caf9ad7657 100644 --- a/crates/router/tests/connectors/cashtocode.rs +++ b/crates/router/tests/connectors/cashtocode.rs @@ -93,7 +93,6 @@ impl CashtocodeTest { None, None, )), - return_url: Some("https://google.com".to_owned()), ..Default::default() }) } diff --git a/crates/router/tests/connectors/cryptopay.rs b/crates/router/tests/connectors/cryptopay.rs index 2ecc7869bcd2..58fcdc6dae2c 100644 --- a/crates/router/tests/connectors/cryptopay.rs +++ b/crates/router/tests/connectors/cryptopay.rs @@ -61,7 +61,6 @@ fn get_default_payment_info() -> Option { None, None, )), - return_url: Some(String::from("https://google.com")), ..Default::default() }) } diff --git a/crates/router/tests/connectors/iatapay.rs b/crates/router/tests/connectors/iatapay.rs index d216f6063f6d..89fc270e6a2a 100644 --- a/crates/router/tests/connectors/iatapay.rs +++ b/crates/router/tests/connectors/iatapay.rs @@ -79,7 +79,6 @@ fn get_default_payment_info() -> Option { None, )), access_token: get_access_token(), - return_url: Some(String::from("https://hyperswitch.io")), ..Default::default() }) } diff --git a/crates/router/tests/connectors/opennode.rs b/crates/router/tests/connectors/opennode.rs index d2629e287ca6..6605ea46c328 100644 --- a/crates/router/tests/connectors/opennode.rs +++ b/crates/router/tests/connectors/opennode.rs @@ -61,7 +61,6 @@ fn get_default_payment_info() -> Option { None, None, )), - return_url: Some(String::from("https://google.com")), ..Default::default() }) } diff --git a/crates/router/tests/connectors/payme.rs b/crates/router/tests/connectors/payme.rs index 1994acb6a659..b9dc05ca5537 100644 --- a/crates/router/tests/connectors/payme.rs +++ b/crates/router/tests/connectors/payme.rs @@ -66,7 +66,6 @@ fn get_default_payment_info() -> Option { auth_type: None, access_token: None, connector_meta_data: None, - return_url: None, connector_customer: None, payment_method_token: None, #[cfg(feature = "payouts")] diff --git a/crates/router/tests/connectors/square.rs b/crates/router/tests/connectors/square.rs index f7b633e8a152..8f5fa4a32c70 100644 --- a/crates/router/tests/connectors/square.rs +++ b/crates/router/tests/connectors/square.rs @@ -42,7 +42,6 @@ fn get_default_payment_info(payment_method_token: Option) -> Option, pub access_token: Option, pub connector_meta_data: Option, - pub return_url: Option, pub connector_customer: Option, pub payment_method_token: Option, #[cfg(feature = "payouts")] @@ -503,7 +502,6 @@ pub trait ConnectorActions: Connector { payment_method: enums::PaymentMethod::Card, connector_auth_type: self.get_auth_token(), description: Some("This is a test".to_string()), - return_url: info.clone().and_then(|a| a.return_url), payment_method_status: None, request: req, response: Err(types::ErrorResponse::default()),