Bug: Vault connector changes



Need to implement Vault Retrieve for VGS
diff --git a/config/config.example.toml b/config/config.example.toml
index ab7f0ebdef8..e9e51123925 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -309,7 +309,7 @@ trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://stagegw.transnox.com/"
 unified_authentication_service.base_url = "http://localhost:8000"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index a8c1fcfd662..6f78f4ceeef 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -144,7 +144,7 @@ trustpay.base_url = "https://test-tpgw.trustpay.eu/"
 trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://stagegw.transnox.com/"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 1900a06ff79..25208f9081b 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -148,7 +148,7 @@ trustpay.base_url = "https://tpgw.trustpay.eu/"
 trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://gateway.transit-pass.com/"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.live.verygoodvault.com/"
 volt.base_url = "https://api.volt.io/"
 wellsfargo.base_url = "https://api.cybersource.com/"
 wellsfargopayout.base_url = "https://api.wellsfargo.com/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 3c7070879e5..2eb25d54754 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -148,7 +148,7 @@ trustpay.base_url = "https://test-tpgw.trustpay.eu/"
 trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://stagegw.transnox.com/"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
diff --git a/config/development.toml b/config/development.toml
index 9380fa7e6e9..32f7a9441ba 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -355,7 +355,7 @@ trustpay.base_url = "https://test-tpgw.trustpay.eu/"
 trustpayments.base_url = "https://webservices.securetrading.net/"
 tsys.base_url = "https://stagegw.transnox.com/"
 unified_authentication_service.base_url = "http://localhost:8000/"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index dcf86bbcfa5..6c11cc9bef9 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -235,7 +235,7 @@ trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://stagegw.transnox.com/"
 unified_authentication_service.base_url = "http://localhost:8000"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
diff --git a/crates/hyperswitch_connectors/src/connectors/vgs.rs b/crates/hyperswitch_connectors/src/connectors/vgs.rs
index 68751d6e44a..d7bdf4522eb 100644
--- a/crates/hyperswitch_connectors/src/connectors/vgs.rs
+++ b/crates/hyperswitch_connectors/src/connectors/vgs.rs
@@ -1,10 +1,10 @@
 pub mod transformers;
 
+use base64::Engine;
 use common_utils::{
     errors::CustomResult,
     ext_traits::BytesExt,
     request::{Method, Request, RequestBuilder, RequestContent},
-    types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
 };
 use error_stack::{report, ResultExt};
 use hyperswitch_domain_models::{
@@ -13,17 +13,15 @@ use hyperswitch_domain_models::{
         access_token_auth::AccessTokenAuth,
         payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
         refunds::{Execute, RSync},
+        ExternalVaultInsertFlow, ExternalVaultRetrieveFlow,
     },
     router_request_types::{
         AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
         PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
-        RefundsData, SetupMandateRequestData,
-    },
-    router_response_types::{PaymentsResponseData, RefundsResponseData},
-    types::{
-        PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
-        RefundSyncRouterData, RefundsRouterData,
+        RefundsData, SetupMandateRequestData, VaultRequestData,
     },
+    router_response_types::{PaymentsResponseData, RefundsResponseData, VaultResponseData},
+    types::VaultRouterData,
 };
 use hyperswitch_interfaces::{
     api::{
@@ -36,23 +34,13 @@ use hyperswitch_interfaces::{
     types::{self, Response},
     webhooks,
 };
-use masking::{ExposeInterface, Mask};
+use masking::Mask;
 use transformers as vgs;
 
-use crate::{constants::headers, types::ResponseRouterData, utils};
+use crate::{constants::headers, types::ResponseRouterData};
 
 #[derive(Clone)]
-pub struct Vgs {
-    amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
-}
-
-impl Vgs {
-    pub fn new() -> &'static Self {
-        &Self {
-            amount_converter: &StringMinorUnitForConnector,
-        }
-    }
-}
+pub struct Vgs;
 
 impl api::Payment for Vgs {}
 impl api::PaymentSession for Vgs {}
@@ -66,6 +54,9 @@ impl api::Refund for Vgs {}
 impl api::RefundExecute for Vgs {}
 impl api::RefundSync for Vgs {}
 impl api::PaymentToken for Vgs {}
+impl api::ExternalVaultInsert for Vgs {}
+impl api::ExternalVault for Vgs {}
+impl api::ExternalVaultRetrieve for Vgs {}
 
 impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
     for Vgs
@@ -82,13 +73,21 @@ where
         req: &RouterData<Flow, Request, Response>,
         _connectors: &Connectors,
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
-        let mut header = vec![(
-            headers::CONTENT_TYPE.to_string(),
-            self.get_content_type().to_string().into(),
-        )];
-        let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
-        header.append(&mut api_key);
-        Ok(header)
+        let auth = vgs::VgsAuthType::try_from(&req.connector_auth_type)
+            .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+        let auth_value = auth
+            .username
+            .zip(auth.password)
+            .map(|(username, password)| {
+                format!(
+                    "Basic {}",
+                    common_utils::consts::BASE64_ENGINE.encode(format!("{username}:{password}"))
+                )
+            });
+        Ok(vec![(
+            headers::AUTHORIZATION.to_string(),
+            auth_value.into_masked(),
+        )])
     }
 }
 
@@ -111,14 +110,9 @@ impl ConnectorCommon for Vgs {
 
     fn get_auth_header(
         &self,
-        auth_type: &ConnectorAuthType,
+        _auth_type: &ConnectorAuthType,
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
-        let auth = vgs::VgsAuthType::try_from(auth_type)
-            .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
-        Ok(vec![(
-            headers::AUTHORIZATION.to_string(),
-            auth.username.expose().into_masked(),
-        )])
+        Ok(vec![])
     }
 
     fn build_error_response(
@@ -134,11 +128,16 @@ impl ConnectorCommon for Vgs {
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
 
+        let error = response
+            .errors
+            .first()
+            .ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
+
         Ok(ErrorResponse {
             status_code: res.status_code,
-            code: response.code,
-            message: response.message,
-            reason: response.reason,
+            code: error.code.clone(),
+            message: error.code.clone(),
+            reason: error.detail.clone(),
             attempt_status: None,
             connector_transaction_id: None,
             network_decline_code: None,
@@ -149,212 +148,68 @@ impl ConnectorCommon for Vgs {
     }
 }
 
-impl ConnectorValidation for Vgs {
-    //TODO: implement functions when support enabled
-}
+impl ConnectorValidation for Vgs {}
 
-impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Vgs {
-    //TODO: implement sessions flow
-}
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Vgs {}
 
 impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Vgs {}
 
 impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Vgs {}
 
-impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Vgs {
-    fn get_headers(
-        &self,
-        req: &PaymentsAuthorizeRouterData,
-        connectors: &Connectors,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
-        self.build_headers(req, connectors)
-    }
-
-    fn get_content_type(&self) -> &'static str {
-        self.common_get_content_type()
-    }
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Vgs {}
 
-    fn get_url(
-        &self,
-        _req: &PaymentsAuthorizeRouterData,
-        _connectors: &Connectors,
-    ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
-    }
-
-    fn get_request_body(
-        &self,
-        req: &PaymentsAuthorizeRouterData,
-        _connectors: &Connectors,
-    ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        let amount = utils::convert_amount(
-            self.amount_converter,
-            req.request.minor_amount,
-            req.request.currency,
-        )?;
-
-        let connector_router_data = vgs::VgsRouterData::from((amount, req));
-        let connector_req = vgs::VgsPaymentsRequest::try_from(&connector_router_data)?;
-        Ok(RequestContent::Json(Box::new(connector_req)))
-    }
-
-    fn build_request(
-        &self,
-        req: &PaymentsAuthorizeRouterData,
-        connectors: &Connectors,
-    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
-        Ok(Some(
-            RequestBuilder::new()
-                .method(Method::Post)
-                .url(&types::PaymentsAuthorizeType::get_url(
-                    self, req, connectors,
-                )?)
-                .attach_default_headers()
-                .headers(types::PaymentsAuthorizeType::get_headers(
-                    self, req, connectors,
-                )?)
-                .set_body(types::PaymentsAuthorizeType::get_request_body(
-                    self, req, connectors,
-                )?)
-                .build(),
-        ))
-    }
+impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Vgs {}
 
-    fn handle_response(
-        &self,
-        data: &PaymentsAuthorizeRouterData,
-        event_builder: Option<&mut ConnectorEvent>,
-        res: Response,
-    ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
-        let response: vgs::VgsPaymentsResponse = res
-            .response
-            .parse_struct("Vgs PaymentsAuthorizeResponse")
-            .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,
-        })
-    }
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Vgs {}
 
-    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<Void, PaymentsCancelData, PaymentsResponseData> for Vgs {}
 
-impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Vgs {
-    fn get_headers(
-        &self,
-        req: &PaymentsSyncRouterData,
-        connectors: &Connectors,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
-        self.build_headers(req, connectors)
-    }
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Vgs {}
 
-    fn get_content_type(&self) -> &'static str {
-        self.common_get_content_type()
-    }
+impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Vgs {}
 
+impl ConnectorIntegration<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData> for Vgs {
     fn get_url(
         &self,
-        _req: &PaymentsSyncRouterData,
-        _connectors: &Connectors,
-    ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
-    }
-
-    fn build_request(
-        &self,
-        req: &PaymentsSyncRouterData,
+        _req: &VaultRouterData<ExternalVaultInsertFlow>,
         connectors: &Connectors,
-    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
-        Ok(Some(
-            RequestBuilder::new()
-                .method(Method::Get)
-                .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
-                .attach_default_headers()
-                .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
-                .build(),
-        ))
-    }
-
-    fn handle_response(
-        &self,
-        data: &PaymentsSyncRouterData,
-        event_builder: Option<&mut ConnectorEvent>,
-        res: Response,
-    ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
-        let response: vgs::VgsPaymentsResponse = res
-            .response
-            .parse_struct("vgs PaymentsSyncResponse")
-            .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,
-        })
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Ok(format!("{}aliases", self.base_url(connectors)))
     }
 
-    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<Capture, PaymentsCaptureData, PaymentsResponseData> for Vgs {
     fn get_headers(
         &self,
-        req: &PaymentsCaptureRouterData,
+        req: &VaultRouterData<ExternalVaultInsertFlow>,
         connectors: &Connectors,
     ) -> CustomResult<Vec<(String, 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: &PaymentsCaptureRouterData,
-        _connectors: &Connectors,
-    ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
-    }
-
     fn get_request_body(
         &self,
-        _req: &PaymentsCaptureRouterData,
+        req: &VaultRouterData<ExternalVaultInsertFlow>,
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+        let connector_req = vgs::VgsInsertRequest::try_from(req)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
     }
 
     fn build_request(
         &self,
-        req: &PaymentsCaptureRouterData,
+        req: &VaultRouterData<ExternalVaultInsertFlow>,
         connectors: &Connectors,
     ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         Ok(Some(
             RequestBuilder::new()
                 .method(Method::Post)
-                .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+                .url(&types::ExternalVaultInsertType::get_url(
+                    self, req, connectors,
+                )?)
                 .attach_default_headers()
-                .headers(types::PaymentsCaptureType::get_headers(
+                .headers(types::ExternalVaultInsertType::get_headers(
                     self, req, connectors,
                 )?)
-                .set_body(types::PaymentsCaptureType::get_request_body(
+                .set_body(types::ExternalVaultInsertType::get_request_body(
                     self, req, connectors,
                 )?)
                 .build(),
@@ -363,13 +218,13 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
 
     fn handle_response(
         &self,
-        data: &PaymentsCaptureRouterData,
+        data: &VaultRouterData<ExternalVaultInsertFlow>,
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
-    ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
-        let response: vgs::VgsPaymentsResponse = res
+    ) -> CustomResult<VaultRouterData<ExternalVaultInsertFlow>, errors::ConnectorError> {
+        let response: vgs::VgsInsertResponse = res
             .response
-            .parse_struct("Vgs PaymentsCaptureResponse")
+            .parse_struct("VgsInsertResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
@@ -389,125 +244,46 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
     }
 }
 
-impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Vgs {}
-
-impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Vgs {
-    fn get_headers(
-        &self,
-        req: &RefundsRouterData<Execute>,
-        connectors: &Connectors,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
-        self.build_headers(req, connectors)
-    }
-
-    fn get_content_type(&self) -> &'static str {
-        self.common_get_content_type()
-    }
-
+impl ConnectorIntegration<ExternalVaultRetrieveFlow, VaultRequestData, VaultResponseData> for Vgs {
     fn get_url(
         &self,
-        _req: &RefundsRouterData<Execute>,
-        _connectors: &Connectors,
+        req: &VaultRouterData<ExternalVaultRetrieveFlow>,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
-    }
-
-    fn get_request_body(
-        &self,
-        req: &RefundsRouterData<Execute>,
-        _connectors: &Connectors,
-    ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        let refund_amount = utils::convert_amount(
-            self.amount_converter,
-            req.request.minor_refund_amount,
-            req.request.currency,
+        let alias = req.request.connector_vault_id.clone().ok_or(
+            errors::ConnectorError::MissingRequiredField {
+                field_name: "connector_vault_id",
+            },
         )?;
 
-        let connector_router_data = vgs::VgsRouterData::from((refund_amount, req));
-        let connector_req = vgs::VgsRefundRequest::try_from(&connector_router_data)?;
-        Ok(RequestContent::Json(Box::new(connector_req)))
-    }
-
-    fn build_request(
-        &self,
-        req: &RefundsRouterData<Execute>,
-        connectors: &Connectors,
-    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
-        let request = RequestBuilder::new()
-            .method(Method::Post)
-            .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
-            .attach_default_headers()
-            .headers(types::RefundExecuteType::get_headers(
-                self, req, connectors,
-            )?)
-            .set_body(types::RefundExecuteType::get_request_body(
-                self, req, connectors,
-            )?)
-            .build();
-        Ok(Some(request))
-    }
-
-    fn handle_response(
-        &self,
-        data: &RefundsRouterData<Execute>,
-        event_builder: Option<&mut ConnectorEvent>,
-        res: Response,
-    ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
-        let response: vgs::RefundResponse = res
-            .response
-            .parse_struct("vgs RefundResponse")
-            .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)
+        Ok(format!("{}aliases/{alias}", self.base_url(connectors)))
     }
-}
 
-impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Vgs {
     fn get_headers(
         &self,
-        req: &RefundSyncRouterData,
+        req: &VaultRouterData<ExternalVaultRetrieveFlow>,
         connectors: &Connectors,
     ) -> CustomResult<Vec<(String, 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: &RefundSyncRouterData,
-        _connectors: &Connectors,
-    ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+    fn get_http_method(&self) -> Method {
+        Method::Get
     }
 
     fn build_request(
         &self,
-        req: &RefundSyncRouterData,
+        req: &VaultRouterData<ExternalVaultRetrieveFlow>,
         connectors: &Connectors,
     ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         Ok(Some(
             RequestBuilder::new()
                 .method(Method::Get)
-                .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+                .url(&types::ExternalVaultRetrieveType::get_url(
+                    self, req, connectors,
+                )?)
                 .attach_default_headers()
-                .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
-                .set_body(types::RefundSyncType::get_request_body(
+                .headers(types::ExternalVaultRetrieveType::get_headers(
                     self, req, connectors,
                 )?)
                 .build(),
@@ -516,14 +292,14 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Vgs {
 
     fn handle_response(
         &self,
-        data: &RefundSyncRouterData,
+        data: &VaultRouterData<ExternalVaultRetrieveFlow>,
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
-    ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
-        let response: vgs::RefundResponse = res
-            .response
-            .parse_struct("vgs RefundSyncResponse")
-            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+    ) -> CustomResult<VaultRouterData<ExternalVaultRetrieveFlow>, errors::ConnectorError> {
+        let response: vgs::VgsRetrieveResponse =
+            res.response
+                .parse_struct("VgsRetrieveResponse")
+                .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 {
diff --git a/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs b/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
index f30a455ef4d..4915e2da400 100644
--- a/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
@@ -1,23 +1,22 @@
-use common_enums::enums;
-use common_utils::types::StringMinorUnit;
+use common_utils::{
+    ext_traits::{Encode, StringExt},
+    types::StringMinorUnit,
+};
+use error_stack::ResultExt;
 use hyperswitch_domain_models::{
-    payment_method_data::PaymentMethodData,
     router_data::{ConnectorAuthType, RouterData},
-    router_flow_types::refunds::{Execute, RSync},
-    router_request_types::ResponseId,
-    router_response_types::{PaymentsResponseData, RefundsResponseData},
-    types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+    router_flow_types::{ExternalVaultInsertFlow, ExternalVaultRetrieveFlow},
+    router_request_types::VaultRequestData,
+    router_response_types::VaultResponseData,
+    types::VaultRouterData,
+    vault::PaymentMethodVaultingData,
 };
 use hyperswitch_interfaces::errors;
-use masking::Secret;
+use masking::{ExposeInterface, Secret};
 use serde::{Deserialize, Serialize};
 
-use crate::{
-    types::{RefundsResponseRouterData, ResponseRouterData},
-    utils::PaymentsAuthorizeRequestData,
-};
+use crate::types::ResponseRouterData;
 
-//TODO: Fill the struct with respective fields
 pub struct VgsRouterData<T> {
     pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
     pub router_data: T,
@@ -25,7 +24,6 @@ pub struct VgsRouterData<T> {
 
 impl<T> From<(StringMinorUnit, T)> for VgsRouterData<T> {
     fn from((amount, item): (StringMinorUnit, T)) -> Self {
-        //Todo :  use utils to convert the amount to the type of amount that a connector accepts
         Self {
             amount,
             router_data: item,
@@ -33,49 +31,48 @@ impl<T> From<(StringMinorUnit, T)> for VgsRouterData<T> {
     }
 }
 
-//TODO: Fill the struct with respective fields
+const VGS_FORMAT: &str = "UUID";
+const VGS_CLASSIFIER: &str = "data";
+
 #[derive(Default, Debug, Serialize, PartialEq)]
-pub struct VgsPaymentsRequest {
-    amount: StringMinorUnit,
-    card: VgsCard,
+pub struct VgsTokenRequestItem {
+    value: Secret<String>,
+    classifiers: Vec<String>,
+    format: String,
 }
 
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct VgsCard {
-    number: cards::CardNumber,
-    expiry_month: Secret<String>,
-    expiry_year: Secret<String>,
-    cvc: Secret<String>,
-    complete: bool,
+#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct VgsInsertRequest {
+    data: Vec<VgsTokenRequestItem>,
 }
 
-impl TryFrom<&VgsRouterData<&PaymentsAuthorizeRouterData>> for VgsPaymentsRequest {
+impl<F> TryFrom<&VaultRouterData<F>> for VgsInsertRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(item: &VgsRouterData<&PaymentsAuthorizeRouterData>) -> Result<Self, Self::Error> {
-        match item.router_data.request.payment_method_data.clone() {
-            PaymentMethodData::Card(req_card) => {
-                let card = VgsCard {
-                    number: req_card.card_number,
-                    expiry_month: req_card.card_exp_month,
-                    expiry_year: req_card.card_exp_year,
-                    cvc: req_card.card_cvc,
-                    complete: item.router_data.request.is_auto_capture()?,
-                };
+    fn try_from(item: &VaultRouterData<F>) -> Result<Self, Self::Error> {
+        match item.request.payment_method_vaulting_data.clone() {
+            Some(PaymentMethodVaultingData::Card(req_card)) => {
+                let stringified_card = req_card
+                    .encode_to_string_of_json()
+                    .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+
                 Ok(Self {
-                    amount: item.amount.clone(),
-                    card,
+                    data: vec![VgsTokenRequestItem {
+                        value: Secret::new(stringified_card),
+                        classifiers: vec![VGS_CLASSIFIER.to_string()],
+                        format: VGS_FORMAT.to_string(),
+                    }],
                 })
             }
-            _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+            _ => Err(errors::ConnectorError::NotImplemented(
+                "Payment method apart from card".to_string(),
+            )
+            .into()),
         }
     }
 }
 
-//TODO: Fill the struct with respective fields
-// Auth Struct
 pub struct VgsAuthType {
     pub(super) username: Secret<String>,
-    #[allow(dead_code)]
     pub(super) password: Secret<String>,
 }
 
@@ -83,7 +80,7 @@ impl TryFrom<&ConnectorAuthType> for VgsAuthType {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
         match auth_type {
-            ConnectorAuthType::SignatureKey { api_key, key1, .. } => Ok(Self {
+            ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
                 username: api_key.to_owned(),
                 password: key1.to_owned(),
             }),
@@ -91,139 +88,120 @@ impl TryFrom<&ConnectorAuthType> for VgsAuthType {
         }
     }
 }
-// PaymentsResponse
-//TODO: Append the remaining status flags
-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "lowercase")]
-pub enum VgsPaymentStatus {
-    Succeeded,
-    Failed,
-    #[default]
-    Processing,
+
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct VgsAliasItem {
+    alias: String,
+    format: String,
 }
 
-impl From<VgsPaymentStatus> for common_enums::AttemptStatus {
-    fn from(item: VgsPaymentStatus) -> Self {
-        match item {
-            VgsPaymentStatus::Succeeded => Self::Charged,
-            VgsPaymentStatus::Failed => Self::Failure,
-            VgsPaymentStatus::Processing => Self::Authorizing,
-        }
-    }
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct VgsTokenResponseItem {
+    value: Secret<String>,
+    classifiers: Vec<String>,
+    aliases: Vec<VgsAliasItem>,
+    created_at: Option<String>,
+    storage: String,
 }
 
-//TODO: Fill the struct with respective fields
 #[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct VgsPaymentsResponse {
-    status: VgsPaymentStatus,
-    id: String,
+pub struct VgsInsertResponse {
+    data: Vec<VgsTokenResponseItem>,
 }
 
-impl<F, T> TryFrom<ResponseRouterData<F, VgsPaymentsResponse, T, PaymentsResponseData>>
-    for RouterData<F, T, PaymentsResponseData>
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct VgsRetrieveResponse {
+    data: Vec<VgsTokenResponseItem>,
+}
+
+impl
+    TryFrom<
+        ResponseRouterData<
+            ExternalVaultInsertFlow,
+            VgsInsertResponse,
+            VaultRequestData,
+            VaultResponseData,
+        >,
+    > for RouterData<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData>
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: ResponseRouterData<F, VgsPaymentsResponse, T, PaymentsResponseData>,
+        item: ResponseRouterData<
+            ExternalVaultInsertFlow,
+            VgsInsertResponse,
+            VaultRequestData,
+            VaultResponseData,
+        >,
     ) -> Result<Self, Self::Error> {
+        let vgs_alias = item
+            .response
+            .data
+            .first()
+            .and_then(|val| val.aliases.first())
+            .ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
+
         Ok(Self {
-            status: common_enums::AttemptStatus::from(item.response.status),
-            response: Ok(PaymentsResponseData::TransactionResponse {
-                resource_id: ResponseId::ConnectorTransactionId(item.response.id),
-                redirection_data: Box::new(None),
-                mandate_reference: Box::new(None),
-                connector_metadata: None,
-                network_txn_id: None,
-                connector_response_reference_id: None,
-                incremental_authorization_allowed: None,
-                charges: None,
+            status: common_enums::AttemptStatus::Started,
+            response: Ok(VaultResponseData::ExternalVaultInsertResponse {
+                connector_vault_id: vgs_alias.alias.clone(),
+                fingerprint_id: vgs_alias.alias.clone(),
             }),
             ..item.data
         })
     }
 }
 
-//TODO: Fill the struct with respective fields
-// REFUND :
-// Type definition for RefundRequest
-#[derive(Default, Debug, Serialize)]
-pub struct VgsRefundRequest {
-    pub amount: StringMinorUnit,
-}
-
-impl<F> TryFrom<&VgsRouterData<&RefundsRouterData<F>>> for VgsRefundRequest {
-    type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(item: &VgsRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
-        Ok(Self {
-            amount: item.amount.to_owned(),
-        })
-    }
-}
-
-// Type definition for Refund Response
-
-#[allow(dead_code)]
-#[derive(Debug, Serialize, Default, Deserialize, Clone)]
-pub enum RefundStatus {
-    Succeeded,
-    Failed,
-    #[default]
-    Processing,
-}
-
-impl From<RefundStatus> for enums::RefundStatus {
-    fn from(item: RefundStatus) -> Self {
-        match item {
-            RefundStatus::Succeeded => Self::Success,
-            RefundStatus::Failed => Self::Failure,
-            RefundStatus::Processing => Self::Pending,
-            //TODO: Review mapping
-        }
-    }
-}
-
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize)]
-pub struct RefundResponse {
-    id: String,
-    status: RefundStatus,
-}
-
-impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+impl
+    TryFrom<
+        ResponseRouterData<
+            ExternalVaultRetrieveFlow,
+            VgsRetrieveResponse,
+            VaultRequestData,
+            VaultResponseData,
+        >,
+    > for RouterData<ExternalVaultRetrieveFlow, VaultRequestData, VaultResponseData>
+{
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: RefundsResponseRouterData<Execute, RefundResponse>,
+        item: ResponseRouterData<
+            ExternalVaultRetrieveFlow,
+            VgsRetrieveResponse,
+            VaultRequestData,
+            VaultResponseData,
+        >,
     ) -> Result<Self, Self::Error> {
+        let token_response_item = item
+            .response
+            .data
+            .first()
+            .ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
+
+        let card_detail: api_models::payment_methods::CardDetail = token_response_item
+            .value
+            .clone()
+            .expose()
+            .parse_struct("CardDetail")
+            .change_context(errors::ConnectorError::ParsingFailed)?;
+
         Ok(Self {
-            response: Ok(RefundsResponseData {
-                connector_refund_id: item.response.id.to_string(),
-                refund_status: enums::RefundStatus::from(item.response.status),
+            status: common_enums::AttemptStatus::Started,
+            response: Ok(VaultResponseData::ExternalVaultRetrieveResponse {
+                vault_data: PaymentMethodVaultingData::Card(card_detail),
             }),
             ..item.data
         })
     }
 }
 
-impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
-    type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(
-        item: RefundsResponseRouterData<RSync, RefundResponse>,
-    ) -> Result<Self, Self::Error> {
-        Ok(Self {
-            response: Ok(RefundsResponseData {
-                connector_refund_id: item.response.id.to_string(),
-                refund_status: enums::RefundStatus::from(item.response.status),
-            }),
-            ..item.data
-        })
-    }
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+pub struct VgsErrorItem {
+    pub status: u16,
+    pub code: String,
+    pub detail: Option<String>,
 }
 
-//TODO: Fill the struct with respective fields
 #[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
 pub struct VgsErrorResponse {
-    pub status_code: u16,
-    pub code: String,
-    pub message: String,
-    pub reason: Option<String>,
+    pub errors: Vec<VgsErrorItem>,
+    pub trace_id: String,
 }
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 7d746072f67..963e233c44c 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -6977,7 +6977,6 @@ default_imp_for_external_vault!(
     connectors::Worldpayxml,
     connectors::Wellsfargo,
     connectors::Wellsfargopayout,
-    connectors::Vgs,
     connectors::Volt,
     connectors::Xendit,
     connectors::Zen,
@@ -7120,7 +7119,6 @@ default_imp_for_external_vault_insert!(
     connectors::Worldpayxml,
     connectors::Wellsfargo,
     connectors::Wellsfargopayout,
-    connectors::Vgs,
     connectors::Volt,
     connectors::Xendit,
     connectors::Zen,
@@ -7263,7 +7261,6 @@ default_imp_for_external_vault_retrieve!(
     connectors::Worldpayxml,
     connectors::Wellsfargo,
     connectors::Wellsfargopayout,
-    connectors::Vgs,
     connectors::Volt,
     connectors::Xendit,
     connectors::Zen,
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 1ea747d8101..3a072e12cc7 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -1036,11 +1036,14 @@ pub async fn create_payment_method_card_core(
     .await;
 
     let (response, payment_method) = match vaulting_result {
-        Ok(pm_types::AddVaultResponse {
-            vault_id,
-            fingerprint_id,
-            ..
-        }) => {
+        Ok((
+            pm_types::AddVaultResponse {
+                vault_id,
+                fingerprint_id,
+                ..
+            },
+            external_vault_source,
+        )) => {
             let pm_update = create_pm_additional_data_update(
                 Some(&payment_method_data),
                 state,
@@ -1052,7 +1055,7 @@ pub async fn create_payment_method_card_core(
                 network_tokenization_resp,
                 Some(req.payment_method_type),
                 Some(req.payment_method_subtype),
-                None,
+                external_vault_source,
             )
             .await
             .attach_printable("unable to create payment method data")?;
@@ -2395,7 +2398,10 @@ pub async fn vault_payment_method(
     profile: &domain::Profile,
     existing_vault_id: Option<domain::VaultId>,
     customer_id: &id_type::GlobalCustomerId,
-) -> RouterResult<pm_types::AddVaultResponse> {
+) -> RouterResult<(
+    pm_types::AddVaultResponse,
+    Option<id_type::MerchantConnectorAccountId>,
+)> {
     let is_external_vault_enabled = profile.is_external_vault_enabled();
 
     match is_external_vault_enabled {
@@ -2427,17 +2433,17 @@ pub async fn vault_payment_method(
                 merchant_connector_account,
             )
             .await
+            .map(|value| (value, Some(external_vault_source)))
         }
-        false => {
-            vault_payment_method_internal(
-                state,
-                pmd,
-                merchant_context,
-                existing_vault_id,
-                customer_id,
-            )
-            .await
-        }
+        false => vault_payment_method_internal(
+            state,
+            pmd,
+            merchant_context,
+            existing_vault_id,
+            customer_id,
+        )
+        .await
+        .map(|value| (value, None)),
     }
 }
 
@@ -2812,20 +2818,20 @@ pub async fn update_payment_method_core(
         // cannot use async map because of problems related to lifetimes
         // to overcome this, we will have to use a move closure and add some clones
         Some(ref vault_request_data) => {
-            Some(
-                vault_payment_method(
-                    state,
-                    vault_request_data,
-                    merchant_context,
-                    profile,
-                    // using current vault_id for now,
-                    // will have to refactor this to generate new one on each vaulting later on
-                    current_vault_id,
-                    &payment_method.customer_id,
-                )
-                .await
-                .attach_printable("Failed to add payment method in vault")?,
+            let (vault_response, _) = vault_payment_method(
+                state,
+                vault_request_data,
+                merchant_context,
+                profile,
+                // using current vault_id for now,
+                // will have to refactor this to generate new one on each vaulting later on
+                current_vault_id,
+                &payment_method.customer_id,
             )
+            .await
+            .attach_printable("Failed to add payment method in vault")?;
+
+            Some(vault_response)
         }
         None => None,
     };
diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs
index c184c9db8dd..bd9a1fedeec 100644
--- a/crates/router/src/types/api/connector_mapping.rs
+++ b/crates/router/src/types/api/connector_mapping.rs
@@ -429,7 +429,7 @@ impl ConnectorData {
                 // enums::Connector::UnifiedAuthenticationService => Ok(ConnectorEnum::Old(Box::new(
                 //     connector::UnifiedAuthenticationService,
                 // ))),
-                enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(connector::Vgs::new()))),
+                enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(&connector::Vgs))),
                 enums::Connector::Volt => Ok(ConnectorEnum::Old(Box::new(connector::Volt::new()))),
                 enums::Connector::Wellsfargo => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Wellsfargo::new())))
diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs
index ac7754faa30..c771255dd71 100644
--- a/crates/router/src/types/api/feature_matrix.rs
+++ b/crates/router/src/types/api/feature_matrix.rs
@@ -349,7 +349,7 @@ impl FeatureMatrixConnectorData {
                 // enums::Connector::UnifiedAuthenticationService => Ok(ConnectorEnum::Old(Box::new(
                 //     connector::UnifiedAuthenticationService,
                 // ))),
-                enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(connector::Vgs::new()))),
+                enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(&connector::Vgs))),
                 enums::Connector::Volt => Ok(ConnectorEnum::Old(Box::new(connector::Volt::new()))),
                 enums::Connector::Wellsfargo => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Wellsfargo::new())))
diff --git a/crates/router/tests/connectors/vgs.rs b/crates/router/tests/connectors/vgs.rs
index fb9b6bb30be..70ce1045962 100644
--- a/crates/router/tests/connectors/vgs.rs
+++ b/crates/router/tests/connectors/vgs.rs
@@ -11,7 +11,7 @@ impl utils::Connector for VgsTest {
     fn get_data(&self) -> types::api::ConnectorData {
         use router::connector::Vgs;
         utils::construct_connector_data_old(
-            Box::new(Vgs::new()),
+            Box::new(&Vgs),
             types::Connector::Vgs,
             types::api::GetToken::Connector,
             None,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 9b81a63e182..50a992515a7 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -202,7 +202,7 @@ trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://stagegw.transnox.com/"
 unified_authentication_service.base_url = "http://localhost:8000"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
- Added Connector changes for VGS
- Implemented `ExternalVaultInsertFlow` and `ExternalVaultRetrieveFlow` for VGS
- This allows Payment methods to be vaulted in VGS when `is_external_vault_enabled` is set to true in profile
- Updated VGS URL in TOML files

### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #9023

## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->

Confirm Request:

```
curl --location 'http://localhost:8080/v2/payments/12345_pay_0198d09ccd8a77729274a5c3858e13f3/confirm-intent' \
--header 'x-profile-id: pro_TVu6gSPZXAVEa2h0JCRe' \
--header 'x-client-secret: cs_0198d09cce0774338628683873a2db9d' \
--header 'Authorization: publishable-key=pk_dev_17e15cb3538d4bd99af971ee2d4d081f,client-secret=cs_0198d09cce0774338628683873a2db9d' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_17e15cb3538d4bd99af971ee2d4d081f' \
--data '{
    "payment_method_data": {
        "card": {
            "card_cvc": "123",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_number": "4242424242424242",
            "card_holder_name": "joseph Doe"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "card",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
        "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
        "language": "en-GB",
        "color_depth": 24,
        "screen_height": 1440,
        "screen_width": 2560,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "0.0.0.0"
    },
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "2022-09-10T10:11:12Z",
        "online": {
            "ip_address": "123.32.25.123",
            "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
        }
    }
    
}'
```

Insert Request:
<img width="1598" height="26" alt="image" src="https://github.com/user-attachments/assets/2e2e81e1-360a-481f-a018-91d7da156d54" />

Insert Response:
<img width="2364" height="38" alt="image" src="https://github.com/user-attachments/assets/aad8f89e-144c-4a0e-a6e5-9ec2c6aa957a" />


Confirm Request:

```
curl --location 'http://localhost:8080/v2/payments/12345_pay_0198d09ccd8a77729274a5c3858e13f3/confirm-intent' \
--header 'x-profile-id: pro_TVu6gSPZXAVEa2h0JCRe' \
--header 'x-client-secret: cs_0198d09cce0774338628683873a2db9d' \
--header 'Authorization: publishable-key=pk_dev_17e15cb3538d4bd99af971ee2d4d081f,client-secret=cs_0198d09cce0774338628683873a2db9d' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_17e15cb3538d4bd99af971ee2d4d081f' \
--data '{
    "payment_method_data": {
        "card_token": {
            "card_cvc": "123"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "card",
    "payment_token": "token_UBCgOA3daIE4CP4pugXW"
}'
```


Retrieve Request:
<img width="2364" height="38" alt="image" src="https://github.com/user-attachments/assets/0eaa5d7f-19e1-4cfb-95a4-b6376f8e3c74" />

Retrieve Response:
<img width="2373" height="51" alt="image" src="https://github.com/user-attachments/assets/9b81e22d-931f-4132-a8e4-2a7bd6341c02" />


## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
