Bug: [FEATURE] [Barclaycard] Implement Card Flows



### Feature Description

Implement card flows for Barclaycard

### Possible Implementation

Implement card flows for Barclaycard

### Have you spent some time checking if this feature request has been raised before?

- [x] I checked and didn't find a similar issue

### Have you read the Contributing Guidelines?

- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)

### Are you willing to submit a PR?

Yes, I am willing to submit a PR!
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 00e3e7bc4ff..08b4860a5f4 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -8016,6 +8016,7 @@
           "bambora",
           "bamboraapac",
           "bankofamerica",
+          "barclaycard",
           "billwerk",
           "bitpay",
           "bluesnap",
@@ -21588,6 +21589,7 @@
           "archipel",
           "authorizedotnet",
           "bankofamerica",
+          "barclaycard",
           "billwerk",
           "bitpay",
           "bambora",
diff --git a/config/config.example.toml b/config/config.example.toml
index 52ee69bec10..62bb8e816f9 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -188,7 +188,7 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
 bambora.base_url = "https://api.na.bambora.com"
 bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api"
 bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/"
-barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/pts/v2/"
+barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/"
 billwerk.base_url = "https://api.reepay.com/"
 billwerk.secondary_base_url = "https://card.reepay.com/"
 bitpay.base_url = "https://test.bitpay.com"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 734fa08c88f..aaa79b633b5 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -32,7 +32,7 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
 bambora.base_url = "https://api.na.bambora.com"
 bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api"
 bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/"
-barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/pts/v2/"
+barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/"
 billwerk.base_url = "https://api.reepay.com/"
 billwerk.secondary_base_url = "https://card.reepay.com/"
 bitpay.base_url = "https://test.bitpay.com"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 16e114a7543..1dfa26c4457 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -36,7 +36,7 @@ authorizedotnet.base_url = "https://api.authorize.net/xml/v1/request.api"
 bambora.base_url = "https://api.na.bambora.com"
 bamboraapac.base_url = "https://www.bambora.co.nz/interface/api/dts.asmx"
 bankofamerica.base_url = "https://api.merchant-services.bankofamerica.com/"
-barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/pts/v2/"
+barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/"
 billwerk.base_url = "https://api.reepay.com/"
 billwerk.secondary_base_url = "https://card.reepay.com/"
 bitpay.base_url = "https://bitpay.com"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index ec6572fd71a..9b77ccbac01 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -36,7 +36,7 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
 bambora.base_url = "https://api.na.bambora.com"
 bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api"
 bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/"
-barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/pts/v2/"
+barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/"
 billwerk.base_url = "https://api.reepay.com/"
 billwerk.secondary_base_url = "https://card.reepay.com/"
 bitpay.base_url = "https://test.bitpay.com"
diff --git a/config/development.toml b/config/development.toml
index 7deb3b46992..912173c9d8b 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -239,7 +239,7 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
 bambora.base_url = "https://api.na.bambora.com"
 bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api"
 bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/"
-barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/pts/v2/"
+barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/"
 billwerk.base_url = "https://api.reepay.com/"
 billwerk.secondary_base_url = "https://card.reepay.com/"
 bitpay.base_url = "https://test.bitpay.com"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 855bed5ebd0..1eb4524686a 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -119,7 +119,7 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
 bambora.base_url = "https://api.na.bambora.com"
 bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api"
 bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/"
-barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/pts/v2/"
+barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/"
 billwerk.base_url = "https://api.reepay.com/"
 billwerk.secondary_base_url = "https://card.reepay.com/"
 bitpay.base_url = "https://test.bitpay.com"
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index 0b3d03e6a91..e5db9ec451f 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -65,7 +65,7 @@ pub enum RoutableConnectors {
     Archipel,
     Authorizedotnet,
     Bankofamerica,
-    // Barclaycard,
+    Barclaycard,
     Billwerk,
     Bitpay,
     Bambora,
@@ -219,7 +219,7 @@ pub enum Connector {
     Bambora,
     Bamboraapac,
     Bankofamerica,
-    // Barclaycard,
+    Barclaycard,
     Billwerk,
     Bitpay,
     Bluesnap,
@@ -393,7 +393,7 @@ impl Connector {
             | Self::Bambora
             | Self::Bamboraapac
             | Self::Bankofamerica
-            // | Self::Barclaycard
+            | Self::Barclaycard
             | Self::Billwerk
             | Self::Bitpay
             | Self::Bluesnap
@@ -546,7 +546,7 @@ impl From<RoutableConnectors> for Connector {
             RoutableConnectors::Archipel => Self::Archipel,
             RoutableConnectors::Authorizedotnet => Self::Authorizedotnet,
             RoutableConnectors::Bankofamerica => Self::Bankofamerica,
-            // RoutableConnectors::Barclaycard => Self::Barclaycard,
+            RoutableConnectors::Barclaycard => Self::Barclaycard,
             RoutableConnectors::Billwerk => Self::Billwerk,
             RoutableConnectors::Bitpay => Self::Bitpay,
             RoutableConnectors::Bambora => Self::Bambora,
@@ -660,7 +660,7 @@ impl TryFrom<Connector> for RoutableConnectors {
             Connector::Archipel => Ok(Self::Archipel),
             Connector::Authorizedotnet => Ok(Self::Authorizedotnet),
             Connector::Bankofamerica => Ok(Self::Bankofamerica),
-            // Connector::Barclaycard => Ok(Self::Barclaycard),
+            Connector::Barclaycard => Ok(Self::Barclaycard),
             Connector::Billwerk => Ok(Self::Billwerk),
             Connector::Bitpay => Ok(Self::Bitpay),
             Connector::Bambora => Ok(Self::Bambora),
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 45a26489113..4652b0206e1 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -358,6 +358,7 @@ impl ConnectorConfig {
             Connector::Authorizedotnet => Ok(connector_data.authorizedotnet),
             Connector::Bamboraapac => Ok(connector_data.bamboraapac),
             Connector::Bankofamerica => Ok(connector_data.bankofamerica),
+            Connector::Barclaycard => Ok(connector_data.barclaycard),
             Connector::Billwerk => Ok(connector_data.billwerk),
             Connector::Bitpay => Ok(connector_data.bitpay),
             Connector::Bluesnap => Ok(connector_data.bluesnap),
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 3269efbe596..b4d343356b4 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -949,6 +949,51 @@ required=true
 type="MultiSelect"
 options=["visa","masterCard","amex","discover"]
 
+[barclaycard]
+[[barclaycard.credit]]
+  payment_method_type = "Mastercard"
+[[barclaycard.credit]]
+  payment_method_type = "Visa"
+[[barclaycard.credit]]
+  payment_method_type = "AmericanExpress"
+[[barclaycard.credit]]
+  payment_method_type = "JCB"
+[[barclaycard.credit]]
+  payment_method_type = "Discover"
+[[barclaycard.credit]]
+  payment_method_type = "Maestro"
+[[barclaycard.credit]]
+  payment_method_type = "Interac"
+[[barclaycard.credit]]
+  payment_method_type = "DinersClub"
+[[barclaycard.credit]]
+  payment_method_type = "CartesBancaires"
+[[barclaycard.credit]]
+  payment_method_type = "UnionPay"
+[[barclaycard.debit]]
+  payment_method_type = "Mastercard"
+[[barclaycard.debit]]
+  payment_method_type = "Visa"
+[[barclaycard.debit]]
+  payment_method_type = "AmericanExpress"
+[[barclaycard.debit]]
+  payment_method_type = "JCB"
+[[barclaycard.debit]]
+  payment_method_type = "Discover"
+[[barclaycard.debit]]
+  payment_method_type = "Maestro"
+[[barclaycard.debit]]
+  payment_method_type = "Interac"
+[[barclaycard.debit]]
+  payment_method_type = "DinersClub"
+[[barclaycard.debit]]
+  payment_method_type = "CartesBancaires"
+[[barclaycard.debit]]
+  payment_method_type = "UnionPay"
+[barclaycard.connector_auth.SignatureKey]
+api_key="Key"
+key1="Merchant ID"
+api_secret="Shared Secret"
 
 [bitpay]
 [[bitpay.crypto]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index e467ee970d3..e1f8b6c31d0 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -947,6 +947,51 @@ required=true
 type="MultiSelect"
 options=["PAN_ONLY", "CRYPTOGRAM_3DS"]
 
+[barclaycard]
+[[barclaycard.credit]]
+  payment_method_type = "Mastercard"
+[[barclaycard.credit]]
+  payment_method_type = "Visa"
+[[barclaycard.credit]]
+  payment_method_type = "AmericanExpress"
+[[barclaycard.credit]]
+  payment_method_type = "JCB"
+[[barclaycard.credit]]
+  payment_method_type = "Discover"
+[[barclaycard.credit]]
+  payment_method_type = "Maestro"
+[[barclaycard.credit]]
+  payment_method_type = "Interac"
+[[barclaycard.credit]]
+  payment_method_type = "DinersClub"
+[[barclaycard.credit]]
+  payment_method_type = "CartesBancaires"
+[[barclaycard.credit]]
+  payment_method_type = "UnionPay"
+[[barclaycard.debit]]
+  payment_method_type = "Mastercard"
+[[barclaycard.debit]]
+  payment_method_type = "Visa"
+[[barclaycard.debit]]
+  payment_method_type = "AmericanExpress"
+[[barclaycard.debit]]
+  payment_method_type = "JCB"
+[[barclaycard.debit]]
+  payment_method_type = "Discover"
+[[barclaycard.debit]]
+  payment_method_type = "Maestro"
+[[barclaycard.debit]]
+  payment_method_type = "Interac"
+[[barclaycard.debit]]
+  payment_method_type = "DinersClub"
+[[barclaycard.debit]]
+  payment_method_type = "CartesBancaires"
+[[barclaycard.debit]]
+  payment_method_type = "UnionPay"
+[barclaycard.connector_auth.SignatureKey]
+api_key="Key"
+key1="Merchant ID"
+api_secret="Shared Secret"
 
 [cashtocode]
 [[cashtocode.reward]]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index e8cfdae9e69..2778ff1e82c 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -949,6 +949,51 @@ required=true
 type="MultiSelect"
 options=["visa","masterCard","amex","discover"]
 
+[barclaycard]
+[[barclaycard.credit]]
+  payment_method_type = "Mastercard"
+[[barclaycard.credit]]
+  payment_method_type = "Visa"
+[[barclaycard.credit]]
+  payment_method_type = "AmericanExpress"
+[[barclaycard.credit]]
+  payment_method_type = "JCB"
+[[barclaycard.credit]]
+  payment_method_type = "Discover"
+[[barclaycard.credit]]
+  payment_method_type = "Maestro"
+[[barclaycard.credit]]
+  payment_method_type = "Interac"
+[[barclaycard.credit]]
+  payment_method_type = "DinersClub"
+[[barclaycard.credit]]
+  payment_method_type = "CartesBancaires"
+[[barclaycard.credit]]
+  payment_method_type = "UnionPay"
+[[barclaycard.debit]]
+  payment_method_type = "Mastercard"
+[[barclaycard.debit]]
+  payment_method_type = "Visa"
+[[barclaycard.debit]]
+  payment_method_type = "AmericanExpress"
+[[barclaycard.debit]]
+  payment_method_type = "JCB"
+[[barclaycard.debit]]
+  payment_method_type = "Discover"
+[[barclaycard.debit]]
+  payment_method_type = "Maestro"
+[[barclaycard.debit]]
+  payment_method_type = "Interac"
+[[barclaycard.debit]]
+  payment_method_type = "DinersClub"
+[[barclaycard.debit]]
+  payment_method_type = "CartesBancaires"
+[[barclaycard.debit]]
+  payment_method_type = "UnionPay"
+[barclaycard.connector_auth.SignatureKey]
+api_key="Key"
+key1="Merchant ID"
+api_secret="Shared Secret"
 
 [bitpay]
 [[bitpay.crypto]]
diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
index 9397d063ff6..950b985fa68 100644
--- a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
+++ b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
@@ -1,10 +1,13 @@
 pub mod transformers;
+use std::sync::LazyLock;
 
+use base64::Engine;
+use common_enums::enums;
 use common_utils::{
+    consts,
     errors::CustomResult,
     ext_traits::BytesExt,
     request::{Method, Request, RequestBuilder, RequestContent},
-    types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
 };
 use error_stack::{report, ResultExt};
 use hyperswitch_domain_models::{
@@ -19,10 +22,13 @@ use hyperswitch_domain_models::{
         PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
         RefundsData, SetupMandateRequestData,
     },
-    router_response_types::{PaymentsResponseData, RefundsResponseData},
+    router_response_types::{
+        ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+        SupportedPaymentMethods, SupportedPaymentMethodsExt,
+    },
     types::{
-        PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
-        RefundSyncRouterData, RefundsRouterData,
+        PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+        PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
     },
 };
 use hyperswitch_interfaces::{
@@ -33,24 +39,72 @@ use hyperswitch_interfaces::{
     configs::Connectors,
     errors,
     events::connector_api_logs::ConnectorEvent,
-    types::{self, Response},
+    types::{self, PaymentsVoidType, Response},
     webhooks,
 };
-use masking::{ExposeInterface, Mask};
+use masking::{ExposeInterface, Mask, Maskable, PeekInterface};
+use ring::{digest, hmac};
+use time::OffsetDateTime;
 use transformers as barclaycard;
+use url::Url;
+
+use crate::{
+    constants::{self, headers},
+    types::ResponseRouterData,
+    utils::RefundsRequestData,
+};
 
-use crate::{constants::headers, types::ResponseRouterData, utils};
+pub const V_C_MERCHANT_ID: &str = "v-c-merchant-id";
 
 #[derive(Clone)]
-pub struct Barclaycard {
-    amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
-}
+pub struct Barclaycard;
 
 impl Barclaycard {
-    pub fn new() -> &'static Self {
-        &Self {
-            amount_converter: &StringMinorUnitForConnector,
-        }
+    pub fn generate_digest(&self, payload: &[u8]) -> String {
+        let payload_digest = digest::digest(&digest::SHA256, payload);
+        consts::BASE64_ENGINE.encode(payload_digest)
+    }
+
+    pub fn generate_signature(
+        &self,
+        auth: barclaycard::BarclaycardAuthType,
+        host: String,
+        resource: &str,
+        payload: &String,
+        date: OffsetDateTime,
+        http_method: Method,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        let barclaycard::BarclaycardAuthType {
+            api_key,
+            merchant_account,
+            api_secret,
+        } = auth;
+        let is_post_method = matches!(http_method, Method::Post);
+        let digest_str = if is_post_method { "digest " } else { "" };
+        let headers = format!("host date (request-target) {digest_str}{V_C_MERCHANT_ID}");
+        let request_target = if is_post_method {
+            format!("(request-target): post {resource}\ndigest: SHA-256={payload}\n")
+        } else {
+            format!("(request-target): get {resource}\n")
+        };
+        let signature_string = format!(
+            "host: {host}\ndate: {date}\n{request_target}{V_C_MERCHANT_ID}: {}",
+            merchant_account.peek()
+        );
+        let key_value = consts::BASE64_ENGINE
+            .decode(api_secret.expose())
+            .change_context(errors::ConnectorError::InvalidConnectorConfig {
+                config: "connector_account_details.api_secret",
+            })?;
+        let key = hmac::Key::new(hmac::HMAC_SHA256, &key_value);
+        let signature_value =
+            consts::BASE64_ENGINE.encode(hmac::sign(&key, signature_string.as_bytes()).as_ref());
+        let signature_header = format!(
+            r#"keyid="{}", algorithm="HmacSHA256", headers="{headers}", signature="{signature_value}""#,
+            api_key.peek()
+        );
+
+        Ok(signature_header)
     }
 }
 
@@ -80,15 +134,55 @@ where
     fn build_headers(
         &self,
         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)
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
+        let date = OffsetDateTime::now_utc();
+        let barclaycard_req = self.get_request_body(req, connectors)?;
+        let http_method = self.get_http_method();
+        let auth = barclaycard::BarclaycardAuthType::try_from(&req.connector_auth_type)?;
+        let merchant_account = auth.merchant_account.clone();
+        let base_url = connectors.barclaycard.base_url.as_str();
+        let barclaycard_host =
+            Url::parse(base_url).change_context(errors::ConnectorError::RequestEncodingFailed)?;
+        let host = barclaycard_host
+            .host_str()
+            .ok_or(errors::ConnectorError::RequestEncodingFailed)?;
+        let path: String = self
+            .get_url(req, connectors)?
+            .chars()
+            .skip(base_url.len() - 1)
+            .collect();
+        let sha256 = self.generate_digest(barclaycard_req.get_inner_value().expose().as_bytes());
+        let signature = self.generate_signature(
+            auth,
+            host.to_string(),
+            path.as_str(),
+            &sha256,
+            date,
+            http_method,
+        )?;
+
+        let mut headers = vec![
+            (
+                headers::CONTENT_TYPE.to_string(),
+                self.get_content_type().to_string().into(),
+            ),
+            (
+                headers::ACCEPT.to_string(),
+                "application/hal+json;charset=utf-8".to_string().into(),
+            ),
+            (V_C_MERCHANT_ID.to_string(), merchant_account.into_masked()),
+            ("Date".to_string(), date.to_string().into()),
+            ("Host".to_string(), host.to_string().into()),
+            ("Signature".to_string(), signature.into_masked()),
+        ];
+        if matches!(http_method, Method::Post | Method::Put) {
+            headers.push((
+                "Digest".to_string(),
+                format!("SHA-256={sha256}").into_masked(),
+            ));
+        }
+        Ok(headers)
     }
 }
 
@@ -112,7 +206,7 @@ impl ConnectorCommon for Barclaycard {
     fn get_auth_header(
         &self,
         auth_type: &ConnectorAuthType,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
         let auth = barclaycard::BarclaycardAuthType::try_from(auth_type)
             .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
         Ok(vec![(
@@ -134,17 +228,83 @@ impl ConnectorCommon for Barclaycard {
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
 
-        Ok(ErrorResponse {
-            status_code: res.status_code,
-            code: response.code,
-            message: response.message,
-            reason: response.reason,
-            attempt_status: None,
-            connector_transaction_id: None,
-            network_decline_code: None,
-            network_advice_code: None,
-            network_error_message: None,
-        })
+        let error_message = if res.status_code == 401 {
+            constants::CONNECTOR_UNAUTHORIZED_ERROR
+        } else {
+            hyperswitch_interfaces::consts::NO_ERROR_MESSAGE
+        };
+        match response {
+            transformers::BarclaycardErrorResponse::StandardError(response) => {
+                let (code, message, reason) = match response.error_information {
+                    Some(ref error_info) => {
+                        let detailed_error_info = error_info.details.as_ref().map(|details| {
+                            details
+                                .iter()
+                                .map(|det| format!("{} : {}", det.field, det.reason))
+                                .collect::<Vec<_>>()
+                                .join(", ")
+                        });
+                        (
+                            error_info.reason.clone(),
+                            error_info.reason.clone(),
+                            transformers::get_error_reason(
+                                Some(error_info.message.clone()),
+                                detailed_error_info,
+                                None,
+                            ),
+                        )
+                    }
+                    None => {
+                        let detailed_error_info = response.details.map(|details| {
+                            details
+                                .iter()
+                                .map(|det| format!("{} : {}", det.field, det.reason))
+                                .collect::<Vec<_>>()
+                                .join(", ")
+                        });
+                        (
+                            response.reason.clone().map_or(
+                                hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(),
+                                |reason| reason.to_string(),
+                            ),
+                            response
+                                .reason
+                                .map_or(error_message.to_string(), |reason| reason.to_string()),
+                            transformers::get_error_reason(
+                                response.message,
+                                detailed_error_info,
+                                None,
+                            ),
+                        )
+                    }
+                };
+
+                Ok(ErrorResponse {
+                    status_code: res.status_code,
+                    code,
+                    message,
+                    reason,
+                    attempt_status: None,
+                    connector_transaction_id: None,
+                    network_advice_code: None,
+                    network_decline_code: None,
+                    network_error_message: None,
+                })
+            }
+            transformers::BarclaycardErrorResponse::AuthenticationError(response) => {
+                Ok(ErrorResponse {
+                    status_code: res.status_code,
+                    code: hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(),
+                    message: response.response.rmsg.clone(),
+                    reason: Some(response.response.rmsg),
+                    attempt_status: None,
+                    connector_transaction_id: None,
+                    network_advice_code: None,
+                    network_decline_code: None,
+                    network_error_message: None,
+                })
+            }
+        }
     }
 }
 
@@ -168,7 +328,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
         &self,
         req: &PaymentsAuthorizeRouterData,
         connectors: &Connectors,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
@@ -179,9 +339,12 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
     fn get_url(
         &self,
         _req: &PaymentsAuthorizeRouterData,
-        _connectors: &Connectors,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+        Ok(format!(
+            "{}pts/v2/payments",
+            ConnectorCommon::base_url(self, connectors)
+        ))
     }
 
     fn get_request_body(
@@ -189,13 +352,12 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
         req: &PaymentsAuthorizeRouterData,
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        let amount = utils::convert_amount(
-            self.amount_converter,
-            req.request.minor_amount,
+        let connector_router_data = barclaycard::BarclaycardRouterData::try_from((
+            &self.get_currency_unit(),
             req.request.currency,
-        )?;
-
-        let connector_router_data = barclaycard::BarclaycardRouterData::from((amount, req));
+            req.request.amount,
+            req,
+        ))?;
         let connector_req =
             barclaycard::BarclaycardPaymentsRequest::try_from(&connector_router_data)?;
         Ok(RequestContent::Json(Box::new(connector_req)))
@@ -249,6 +411,43 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
     ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
         self.build_error_response(res, event_builder)
     }
+
+    fn get_5xx_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        let response: barclaycard::BarclaycardServerErrorResponse = res
+            .response
+            .parse_struct("BarclaycardServerErrorResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+        event_builder.map(|event| event.set_response_body(&response));
+        router_env::logger::info!(error_response=?response);
+
+        let attempt_status = match response.reason {
+            Some(reason) => match reason {
+                transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure),
+                transformers::Reason::ServerTimeout | transformers::Reason::ServiceTimeout => None,
+            },
+            None => None,
+        };
+        Ok(ErrorResponse {
+            status_code: res.status_code,
+            reason: response.status.clone(),
+            code: response
+                .status
+                .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),
+            message: response
+                .message
+                .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
+            attempt_status,
+            connector_transaction_id: None,
+            network_advice_code: None,
+            network_decline_code: None,
+            network_error_message: None,
+        })
+    }
 }
 
 impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Barclaycard {
@@ -256,7 +455,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Bar
         &self,
         req: &PaymentsSyncRouterData,
         connectors: &Connectors,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
@@ -264,12 +463,24 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Bar
         self.common_get_content_type()
     }
 
+    fn get_http_method(&self) -> Method {
+        Method::Get
+    }
+
     fn get_url(
         &self,
-        _req: &PaymentsSyncRouterData,
-        _connectors: &Connectors,
+        req: &PaymentsSyncRouterData,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+        let connector_payment_id = req
+            .request
+            .connector_transaction_id
+            .get_connector_transaction_id()
+            .change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
+        Ok(format!(
+            "{}tss/v2/transactions/{connector_payment_id}",
+            self.base_url(connectors)
+        ))
     }
 
     fn build_request(
@@ -293,9 +504,9 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Bar
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
-        let response: barclaycard::BarclaycardPaymentsResponse = res
+        let response: barclaycard::BarclaycardTransactionResponse = res
             .response
-            .parse_struct("barclaycard PaymentsSyncResponse")
+            .parse_struct("Barclaycard PaymentsSyncResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
@@ -320,7 +531,7 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
         &self,
         req: &PaymentsCaptureRouterData,
         connectors: &Connectors,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
@@ -330,18 +541,30 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
 
     fn get_url(
         &self,
-        _req: &PaymentsCaptureRouterData,
-        _connectors: &Connectors,
+        req: &PaymentsCaptureRouterData,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+        let connector_payment_id = req.request.connector_transaction_id.clone();
+        Ok(format!(
+            "{}pts/v2/payments/{connector_payment_id}/captures",
+            self.base_url(connectors)
+        ))
     }
 
     fn get_request_body(
         &self,
-        _req: &PaymentsCaptureRouterData,
+        req: &PaymentsCaptureRouterData,
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+        let connector_router_data = barclaycard::BarclaycardRouterData::try_from((
+            &self.get_currency_unit(),
+            req.request.currency,
+            req.request.amount_to_capture,
+            req,
+        ))?;
+        let connector_req =
+            barclaycard::BarclaycardCaptureRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
     }
 
     fn build_request(
@@ -390,16 +613,167 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
     ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
         self.build_error_response(res, event_builder)
     }
+
+    fn get_5xx_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        let response: barclaycard::BarclaycardServerErrorResponse = res
+            .response
+            .parse_struct("BarclaycardServerErrorResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+        event_builder.map(|event| event.set_response_body(&response));
+        router_env::logger::info!(error_response=?response);
+
+        Ok(ErrorResponse {
+            status_code: res.status_code,
+            reason: response.status.clone(),
+            code: response
+                .status
+                .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),
+            message: response
+                .message
+                .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
+            attempt_status: None,
+            connector_transaction_id: None,
+            network_advice_code: None,
+            network_decline_code: None,
+            network_error_message: None,
+        })
+    }
 }
 
-impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Barclaycard {}
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Barclaycard {
+    fn get_headers(
+        &self,
+        req: &PaymentsCancelRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_url(
+        &self,
+        req: &PaymentsCancelRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        let connector_payment_id = req.request.connector_transaction_id.clone();
+        Ok(format!(
+            "{}pts/v2/payments/{connector_payment_id}/reversals",
+            self.base_url(connectors)
+        ))
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_request_body(
+        &self,
+        req: &PaymentsCancelRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let connector_router_data = barclaycard::BarclaycardRouterData::try_from((
+            &self.get_currency_unit(),
+            req.request
+                .currency
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "Currency",
+                })?,
+            req.request
+                .amount
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "Amount",
+                })?,
+            req,
+        ))?;
+        let connector_req = barclaycard::BarclaycardVoidRequest::try_from(&connector_router_data)?;
+
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &PaymentsCancelRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&PaymentsVoidType::get_url(self, req, connectors)?)
+                .attach_default_headers()
+                .headers(PaymentsVoidType::get_headers(self, req, connectors)?)
+                .set_body(PaymentsVoidType::get_request_body(self, req, connectors)?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsCancelRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
+        let response: barclaycard::BarclaycardPaymentsResponse = res
+            .response
+            .parse_struct("Barclaycard PaymentResponse")
+            .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)
+    }
+
+    fn get_5xx_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        let response: barclaycard::BarclaycardServerErrorResponse = res
+            .response
+            .parse_struct("BarclaycardServerErrorResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+        event_builder.map(|event| event.set_response_body(&response));
+        router_env::logger::info!(error_response=?response);
+
+        Ok(ErrorResponse {
+            status_code: res.status_code,
+            reason: response.status.clone(),
+            code: response
+                .status
+                .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),
+            message: response
+                .message
+                .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
+            attempt_status: None,
+            connector_transaction_id: None,
+            network_advice_code: None,
+            network_decline_code: None,
+            network_error_message: None,
+        })
+    }
+}
 
 impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Barclaycard {
     fn get_headers(
         &self,
         req: &RefundsRouterData<Execute>,
         connectors: &Connectors,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
@@ -409,10 +783,14 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Barclay
 
     fn get_url(
         &self,
-        _req: &RefundsRouterData<Execute>,
-        _connectors: &Connectors,
+        req: &RefundsRouterData<Execute>,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+        let connector_payment_id = req.request.connector_transaction_id.clone();
+        Ok(format!(
+            "{}pts/v2/payments/{connector_payment_id}/refunds",
+            self.base_url(connectors)
+        ))
     }
 
     fn get_request_body(
@@ -420,13 +798,12 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Barclay
         req: &RefundsRouterData<Execute>,
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        let refund_amount = utils::convert_amount(
-            self.amount_converter,
-            req.request.minor_refund_amount,
+        let connector_router_data = barclaycard::BarclaycardRouterData::try_from((
+            &self.get_currency_unit(),
             req.request.currency,
-        )?;
-
-        let connector_router_data = barclaycard::BarclaycardRouterData::from((refund_amount, req));
+            req.request.refund_amount,
+            req,
+        ))?;
         let connector_req =
             barclaycard::BarclaycardRefundRequest::try_from(&connector_router_data)?;
         Ok(RequestContent::Json(Box::new(connector_req)))
@@ -457,7 +834,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Barclay
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
-        let response: barclaycard::RefundResponse = res
+        let response: barclaycard::BarclaycardRefundResponse = res
             .response
             .parse_struct("barclaycard RefundResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -484,7 +861,7 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Barclayca
         &self,
         req: &RefundSyncRouterData,
         connectors: &Connectors,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
@@ -492,12 +869,20 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Barclayca
         self.common_get_content_type()
     }
 
+    fn get_http_method(&self) -> Method {
+        Method::Get
+    }
+
     fn get_url(
         &self,
-        _req: &RefundSyncRouterData,
-        _connectors: &Connectors,
+        req: &RefundSyncRouterData,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+        let refund_id = req.request.get_connector_refund_id()?;
+        Ok(format!(
+            "{}tss/v2/transactions/{refund_id}",
+            self.base_url(connectors)
+        ))
     }
 
     fn build_request(
@@ -524,7 +909,7 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Barclayca
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
-        let response: barclaycard::RefundResponse = res
+        let response: barclaycard::BarclaycardRsyncResponse = res
             .response
             .parse_struct("barclaycard RefundSyncResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -570,4 +955,88 @@ impl webhooks::IncomingWebhook for Barclaycard {
     }
 }
 
-impl ConnectorSpecifications for Barclaycard {}
+static BARCLAYCARD_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+    LazyLock::new(|| {
+        let supported_capture_methods = vec![
+            enums::CaptureMethod::Automatic,
+            enums::CaptureMethod::Manual,
+            enums::CaptureMethod::SequentialAutomatic,
+        ];
+
+        let supported_card_network = vec![
+            common_enums::CardNetwork::Mastercard,
+            common_enums::CardNetwork::Visa,
+            common_enums::CardNetwork::AmericanExpress,
+            common_enums::CardNetwork::JCB,
+            common_enums::CardNetwork::Discover,
+            common_enums::CardNetwork::Maestro,
+            common_enums::CardNetwork::Interac,
+            common_enums::CardNetwork::DinersClub,
+            common_enums::CardNetwork::CartesBancaires,
+            common_enums::CardNetwork::UnionPay,
+        ];
+
+        let mut barclaycard_supported_payment_methods = SupportedPaymentMethods::new();
+
+        barclaycard_supported_payment_methods.add(
+            enums::PaymentMethod::Card,
+            enums::PaymentMethodType::Credit,
+            PaymentMethodDetails {
+                mandates: enums::FeatureStatus::NotSupported,
+                refunds: enums::FeatureStatus::Supported,
+                supported_capture_methods: supported_capture_methods.clone(),
+                specific_features: Some(
+                    api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+                        api_models::feature_matrix::CardSpecificFeatures {
+                            three_ds: common_enums::FeatureStatus::NotSupported,
+                            no_three_ds: common_enums::FeatureStatus::Supported,
+                            supported_card_networks: supported_card_network.clone(),
+                        }
+                    }),
+                ),
+            },
+        );
+
+        barclaycard_supported_payment_methods.add(
+            enums::PaymentMethod::Card,
+            enums::PaymentMethodType::Debit,
+            PaymentMethodDetails {
+                mandates: enums::FeatureStatus::NotSupported,
+                refunds: enums::FeatureStatus::Supported,
+                supported_capture_methods,
+                specific_features: Some(
+                    api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+                        api_models::feature_matrix::CardSpecificFeatures {
+                            three_ds: common_enums::FeatureStatus::NotSupported,
+                            no_three_ds: common_enums::FeatureStatus::Supported,
+                            supported_card_networks: supported_card_network,
+                        }
+                    }),
+                ),
+            },
+        );
+
+        barclaycard_supported_payment_methods
+    });
+
+static BARCLAYCARD_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+    display_name: "BarclayCard SmartPay Fuse",
+    description: "Barclaycard, part of Barclays Bank UK PLC, is a leading global payment business that helps consumers, retailers and businesses to make and take payments flexibly, and to access short-term credit and point of sale finance.",
+    connector_type: enums::PaymentConnectorCategory::BankAcquirer,
+};
+
+static BARCLAYCARD_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
+
+impl ConnectorSpecifications for Barclaycard {
+    fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+        Some(&BARCLAYCARD_CONNECTOR_INFO)
+    }
+
+    fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+        Some(&*BARCLAYCARD_SUPPORTED_PAYMENT_METHODS)
+    }
+
+    fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+        Some(&BARCLAYCARD_SUPPORTED_WEBHOOK_FLOWS)
+    }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
index 1a994d3d2a0..14425bb118a 100644
--- a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
@@ -1,52 +1,458 @@
 use common_enums::enums;
-use common_utils::types::StringMinorUnit;
+use common_utils::pii;
 use hyperswitch_domain_models::{
     payment_method_data::PaymentMethodData,
-    router_data::{ConnectorAuthType, RouterData},
+    router_data::{
+        AdditionalPaymentMethodConnectorResponse, ConnectorAuthType, ConnectorResponseData,
+        ErrorResponse, RouterData,
+    },
     router_flow_types::refunds::{Execute, RSync},
-    router_request_types::ResponseId,
+    router_request_types::{
+        PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSyncData,
+        ResponseId,
+    },
     router_response_types::{PaymentsResponseData, RefundsResponseData},
-    types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+    types::{
+        PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+        RefundsRouterData,
+    },
 };
-use hyperswitch_interfaces::errors;
-use masking::Secret;
+use hyperswitch_interfaces::{api, errors};
+use masking::{ExposeInterface, Secret};
 use serde::{Deserialize, Serialize};
+use serde_json::Value;
 
 use crate::{
+    constants,
     types::{RefundsResponseRouterData, ResponseRouterData},
-    utils::PaymentsAuthorizeRequestData,
+    utils::{
+        self, AddressDetailsData, CardData, PaymentsAuthorizeRequestData, PaymentsSyncRequestData,
+        RouterData as OtherRouterData,
+    },
 };
+pub struct BarclaycardAuthType {
+    pub(super) api_key: Secret<String>,
+    pub(super) merchant_account: Secret<String>,
+    pub(super) api_secret: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for BarclaycardAuthType {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+        if let ConnectorAuthType::SignatureKey {
+            api_key,
+            key1,
+            api_secret,
+        } = auth_type
+        {
+            Ok(Self {
+                api_key: api_key.to_owned(),
+                merchant_account: key1.to_owned(),
+                api_secret: api_secret.to_owned(),
+            })
+        } else {
+            Err(errors::ConnectorError::FailedToObtainAuthType)?
+        }
+    }
+}
 
-//TODO: Fill the struct with respective fields
 pub struct BarclaycardRouterData<T> {
-    pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+    pub amount: String,
     pub router_data: T,
 }
 
-impl<T> From<(StringMinorUnit, T)> for BarclaycardRouterData<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 {
+impl<T> TryFrom<(&api::CurrencyUnit, api_models::enums::Currency, i64, T)>
+    for BarclaycardRouterData<T>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        (currency_unit, currency, amount, item): (
+            &api::CurrencyUnit,
+            api_models::enums::Currency,
+            i64,
+            T,
+        ),
+    ) -> Result<Self, Self::Error> {
+        let amount = utils::get_amount_as_string(currency_unit, amount, currency)?;
+        Ok(Self {
             amount,
             router_data: item,
-        }
+        })
     }
 }
 
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, PartialEq)]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
 pub struct BarclaycardPaymentsRequest {
-    amount: StringMinorUnit,
-    card: BarclaycardCard,
+    processing_information: ProcessingInformation,
+    payment_information: PaymentInformation,
+    order_information: OrderInformationWithBill,
+    client_reference_information: ClientReferenceInformation,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    consumer_authentication_information: Option<BarclaycardConsumerAuthInformation>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    merchant_defined_information: Option<Vec<MerchantDefinedInformation>>,
 }
 
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct BarclaycardCard {
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ProcessingInformation {
+    commerce_indicator: String,
+    capture: Option<bool>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MerchantDefinedInformation {
+    key: u8,
+    value: String,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BarclaycardConsumerAuthInformation {
+    ucaf_collection_indicator: Option<String>,
+    cavv: Option<String>,
+    ucaf_authentication_data: Option<Secret<String>>,
+    xid: Option<String>,
+    directory_server_transaction_id: Option<Secret<String>>,
+    specification_version: Option<String>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardPaymentInformation {
+    card: Card,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(untagged)]
+pub enum PaymentInformation {
+    Cards(Box<CardPaymentInformation>),
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Card {
     number: cards::CardNumber,
-    expiry_month: Secret<String>,
-    expiry_year: Secret<String>,
-    cvc: Secret<String>,
-    complete: bool,
+    expiration_month: Secret<String>,
+    expiration_year: Secret<String>,
+    security_code: Secret<String>,
+    #[serde(rename = "type")]
+    card_type: Option<String>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct OrderInformationWithBill {
+    amount_details: Amount,
+    bill_to: Option<BillTo>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Amount {
+    total_amount: String,
+    currency: api_models::enums::Currency,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BillTo {
+    first_name: Option<Secret<String>>,
+    last_name: Option<Secret<String>>,
+    address1: Option<Secret<String>>,
+    locality: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    administrative_area: Option<Secret<String>>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    postal_code: Option<Secret<String>>,
+    country: Option<enums::CountryAlpha2>,
+    email: pii::Email,
+}
+
+fn build_bill_to(
+    address_details: Option<&hyperswitch_domain_models::address::Address>,
+    email: pii::Email,
+) -> Result<BillTo, error_stack::Report<errors::ConnectorError>> {
+    let default_address = BillTo {
+        first_name: None,
+        last_name: None,
+        address1: None,
+        locality: None,
+        administrative_area: None,
+        postal_code: None,
+        country: None,
+        email: email.clone(),
+    };
+
+    Ok(address_details
+        .and_then(|addr| {
+            addr.address.as_ref().map(|addr| {
+                let administrative_area = addr.to_state_code_as_optional().unwrap_or_else(|_| {
+                    addr.state
+                        .clone()
+                        .map(|state| Secret::new(format!("{:.20}", state.expose())))
+                });
+
+                BillTo {
+                    first_name: addr.first_name.clone(),
+                    last_name: addr.last_name.clone(),
+                    address1: addr.line1.clone(),
+                    locality: addr.city.clone(),
+                    administrative_area,
+                    postal_code: addr.zip.clone(),
+                    country: addr.country,
+                    email,
+                }
+            })
+        })
+        .unwrap_or(default_address))
+}
+
+fn get_barclaycard_card_type(card_network: common_enums::CardNetwork) -> Option<&'static str> {
+    match card_network {
+        common_enums::CardNetwork::Visa => Some("001"),
+        common_enums::CardNetwork::Mastercard => Some("002"),
+        common_enums::CardNetwork::AmericanExpress => Some("003"),
+        common_enums::CardNetwork::JCB => Some("007"),
+        common_enums::CardNetwork::DinersClub => Some("005"),
+        common_enums::CardNetwork::Discover => Some("004"),
+        common_enums::CardNetwork::CartesBancaires => Some("006"),
+        common_enums::CardNetwork::UnionPay => Some("062"),
+        //"042" is the type code for Masetro Cards(International). For Maestro Cards(UK-Domestic) the mapping should be "024"
+        common_enums::CardNetwork::Maestro => Some("042"),
+        common_enums::CardNetwork::Interac
+        | common_enums::CardNetwork::RuPay
+        | common_enums::CardNetwork::Star
+        | common_enums::CardNetwork::Accel
+        | common_enums::CardNetwork::Pulse
+        | common_enums::CardNetwork::Nyce => None,
+    }
+}
+
+impl
+    From<(
+        &BarclaycardRouterData<&PaymentsAuthorizeRouterData>,
+        Option<BillTo>,
+    )> for OrderInformationWithBill
+{
+    fn from(
+        (item, bill_to): (
+            &BarclaycardRouterData<&PaymentsAuthorizeRouterData>,
+            Option<BillTo>,
+        ),
+    ) -> Self {
+        Self {
+            amount_details: Amount {
+                total_amount: item.amount.to_owned(),
+                currency: item.router_data.request.currency,
+            },
+            bill_to,
+        }
+    }
+}
+
+impl
+    TryFrom<(
+        &BarclaycardRouterData<&PaymentsAuthorizeRouterData>,
+        Option<String>,
+    )> for ProcessingInformation
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+
+    fn try_from(
+        (item, network): (
+            &BarclaycardRouterData<&PaymentsAuthorizeRouterData>,
+            Option<String>,
+        ),
+    ) -> Result<Self, Self::Error> {
+        let commerce_indicator = get_commerce_indicator(network);
+
+        Ok(Self {
+            capture: Some(matches!(
+                item.router_data.request.capture_method,
+                Some(enums::CaptureMethod::Automatic) | None
+            )),
+            commerce_indicator,
+        })
+    }
+}
+
+impl From<&BarclaycardRouterData<&PaymentsAuthorizeRouterData>> for ClientReferenceInformation {
+    fn from(item: &BarclaycardRouterData<&PaymentsAuthorizeRouterData>) -> Self {
+        Self {
+            code: Some(item.router_data.connector_request_reference_id.clone()),
+        }
+    }
+}
+
+fn convert_metadata_to_merchant_defined_info(metadata: Value) -> Vec<MerchantDefinedInformation> {
+    let hashmap: std::collections::BTreeMap<String, Value> =
+        serde_json::from_str(&metadata.to_string()).unwrap_or(std::collections::BTreeMap::new());
+    let mut vector = Vec::new();
+    let mut iter = 1;
+    for (key, value) in hashmap {
+        vector.push(MerchantDefinedInformation {
+            key: iter,
+            value: format!("{key}={value}"),
+        });
+        iter += 1;
+    }
+    vector
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ClientReferenceInformation {
+    code: Option<String>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ClientProcessorInformation {
+    avs: Option<Avs>,
+    card_verification: Option<CardVerification>,
+    processor: Option<ProcessorResponse>,
+    network_transaction_id: Option<Secret<String>>,
+    approval_code: Option<String>,
+    merchant_advice: Option<MerchantAdvice>,
+    response_code: Option<String>,
+    ach_verification: Option<AchVerification>,
+    system_trace_audit_number: Option<String>,
+    event_status: Option<String>,
+    retrieval_reference_number: Option<String>,
+    consumer_authentication_response: Option<ConsumerAuthenticationResponse>,
+    response_details: Option<String>,
+    transaction_id: Option<Secret<String>>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MerchantAdvice {
+    code: Option<String>,
+    code_raw: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ConsumerAuthenticationResponse {
+    code: Option<String>,
+    code_raw: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AchVerification {
+    result_code_raw: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ProcessorResponse {
+    name: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardVerification {
+    result_code: Option<String>,
+    result_code_raw: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ClientRiskInformation {
+    rules: Option<Vec<ClientRiskInformationRules>>,
+    profile: Option<Profile>,
+    score: Option<Score>,
+    info_codes: Option<InfoCodes>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InfoCodes {
+    address: Option<Vec<String>>,
+    identity_change: Option<Vec<String>>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Score {
+    factor_codes: Option<Vec<String>>,
+    result: Option<RiskResult>,
+    model_used: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum RiskResult {
+    StringVariant(String),
+    IntVariant(u64),
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Profile {
+    early_decision: Option<String>,
+    name: Option<String>,
+    decision: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+pub struct ClientRiskInformationRules {
+    name: Option<Secret<String>>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Avs {
+    code: Option<String>,
+    code_raw: Option<String>,
+}
+
+impl
+    TryFrom<(
+        &BarclaycardRouterData<&PaymentsAuthorizeRouterData>,
+        hyperswitch_domain_models::payment_method_data::Card,
+    )> for BarclaycardPaymentsRequest
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        (item, ccard): (
+            &BarclaycardRouterData<&PaymentsAuthorizeRouterData>,
+            hyperswitch_domain_models::payment_method_data::Card,
+        ),
+    ) -> Result<Self, Self::Error> {
+        if item.router_data.is_three_ds() {
+            Err(errors::ConnectorError::NotSupported {
+                message: "Card 3DS".to_string(),
+                connector: "Barclaycard",
+            })?
+        };
+
+        let email = item.router_data.request.get_email()?;
+        let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?;
+        let order_information = OrderInformationWithBill::from((item, Some(bill_to)));
+        let payment_information = PaymentInformation::try_from(&ccard)?;
+        let processing_information = ProcessingInformation::try_from((item, None))?;
+        let client_reference_information = ClientReferenceInformation::from(item);
+        let merchant_defined_information = item
+            .router_data
+            .request
+            .metadata
+            .clone()
+            .map(convert_metadata_to_merchant_defined_info);
+
+        Ok(Self {
+            processing_information,
+            payment_information,
+            order_information,
+            client_reference_information,
+            merchant_defined_information,
+            consumer_authentication_information: None,
+        })
+    }
 }
 
 impl TryFrom<&BarclaycardRouterData<&PaymentsAuthorizeRouterData>> for BarclaycardPaymentsRequest {
@@ -55,174 +461,1157 @@ impl TryFrom<&BarclaycardRouterData<&PaymentsAuthorizeRouterData>> for Barclayca
         item: &BarclaycardRouterData<&PaymentsAuthorizeRouterData>,
     ) -> Result<Self, Self::Error> {
         match item.router_data.request.payment_method_data.clone() {
-            PaymentMethodData::Card(req_card) => {
-                let card = BarclaycardCard {
-                    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()?,
+            PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)),
+            PaymentMethodData::Wallet(_)
+            | PaymentMethodData::MandatePayment
+            | PaymentMethodData::CardRedirect(_)
+            | PaymentMethodData::PayLater(_)
+            | PaymentMethodData::BankRedirect(_)
+            | PaymentMethodData::BankDebit(_)
+            | PaymentMethodData::BankTransfer(_)
+            | PaymentMethodData::Crypto(_)
+            | PaymentMethodData::Reward
+            | PaymentMethodData::RealTimePayment(_)
+            | PaymentMethodData::MobilePayment(_)
+            | PaymentMethodData::Upi(_)
+            | PaymentMethodData::Voucher(_)
+            | PaymentMethodData::GiftCard(_)
+            | PaymentMethodData::OpenBanking(_)
+            | PaymentMethodData::CardToken(_)
+            | PaymentMethodData::NetworkToken(_)
+            | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => {
+                Err(errors::ConnectorError::NotImplemented(
+                    utils::get_unimplemented_payment_method_error_message("Barclaycard"),
+                )
+                .into())
+            }
+        }
+    }
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum BarclaycardPaymentStatus {
+    Authorized,
+    Succeeded,
+    Failed,
+    Voided,
+    Reversed,
+    Pending,
+    Declined,
+    Rejected,
+    Challenge,
+    AuthorizedPendingReview,
+    AuthorizedRiskDeclined,
+    Transmitted,
+    InvalidRequest,
+    ServerError,
+    PendingAuthentication,
+    PendingReview,
+    Accepted,
+    Cancelled,
+    //PartialAuthorized, not being consumed yet.
+}
+
+fn map_barclaycard_attempt_status(
+    (status, auto_capture): (BarclaycardPaymentStatus, bool),
+) -> enums::AttemptStatus {
+    match status {
+        BarclaycardPaymentStatus::Authorized
+        | BarclaycardPaymentStatus::AuthorizedPendingReview => {
+            if auto_capture {
+                // Because Barclaycard will return Payment Status as Authorized even in AutoCapture Payment
+                enums::AttemptStatus::Charged
+            } else {
+                enums::AttemptStatus::Authorized
+            }
+        }
+        BarclaycardPaymentStatus::Pending => {
+            if auto_capture {
+                enums::AttemptStatus::Charged
+            } else {
+                enums::AttemptStatus::Pending
+            }
+        }
+        BarclaycardPaymentStatus::Succeeded | BarclaycardPaymentStatus::Transmitted => {
+            enums::AttemptStatus::Charged
+        }
+        BarclaycardPaymentStatus::Voided
+        | BarclaycardPaymentStatus::Reversed
+        | BarclaycardPaymentStatus::Cancelled => enums::AttemptStatus::Voided,
+        BarclaycardPaymentStatus::Failed
+        | BarclaycardPaymentStatus::Declined
+        | BarclaycardPaymentStatus::AuthorizedRiskDeclined
+        | BarclaycardPaymentStatus::InvalidRequest
+        | BarclaycardPaymentStatus::Rejected
+        | BarclaycardPaymentStatus::ServerError => enums::AttemptStatus::Failure,
+        BarclaycardPaymentStatus::PendingAuthentication => {
+            enums::AttemptStatus::AuthenticationPending
+        }
+        BarclaycardPaymentStatus::PendingReview
+        | BarclaycardPaymentStatus::Challenge
+        | BarclaycardPaymentStatus::Accepted => enums::AttemptStatus::Pending,
+    }
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum BarclaycardPaymentsResponse {
+    ClientReferenceInformation(Box<BarclaycardClientReferenceResponse>),
+    ErrorInformation(Box<BarclaycardErrorInformationResponse>),
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BarclaycardClientReferenceResponse {
+    id: String,
+    status: BarclaycardPaymentStatus,
+    client_reference_information: ClientReferenceInformation,
+    processor_information: Option<ClientProcessorInformation>,
+    processing_information: Option<ProcessingInformationResponse>,
+    payment_information: Option<PaymentInformationResponse>,
+    payment_insights_information: Option<PaymentInsightsInformation>,
+    risk_information: Option<ClientRiskInformation>,
+    error_information: Option<BarclaycardErrorInformation>,
+    issuer_information: Option<IssuerInformation>,
+    sender_information: Option<SenderInformation>,
+    payment_account_information: Option<PaymentAccountInformation>,
+    reconciliation_id: Option<String>,
+    consumer_authentication_information: Option<ConsumerAuthenticationInformation>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ConsumerAuthenticationInformation {
+    eci_raw: Option<String>,
+    eci: Option<String>,
+    acs_transaction_id: Option<String>,
+    cavv: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SenderInformation {
+    payment_information: Option<PaymentInformationResponse>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaymentInsightsInformation {
+    response_insights: Option<ResponseInsights>,
+    rule_results: Option<RuleResults>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ResponseInsights {
+    category_code: Option<String>,
+    category: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RuleResults {
+    id: Option<String>,
+    decision: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaymentInformationResponse {
+    tokenized_card: Option<CardResponseObject>,
+    customer: Option<CustomerResponseObject>,
+    card: Option<CardResponseObject>,
+    scheme: Option<String>,
+    bin: Option<String>,
+    account_type: Option<String>,
+    issuer: Option<String>,
+    bin_country: Option<enums::CountryAlpha2>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CustomerResponseObject {
+    customer_id: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaymentAccountInformation {
+    card: Option<PaymentAccountCardInformation>,
+    features: Option<PaymentAccountFeatureInformation>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaymentAccountFeatureInformation {
+    health_card: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaymentAccountCardInformation {
+    #[serde(rename = "type")]
+    card_type: Option<String>,
+    hashed_number: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ProcessingInformationResponse {
+    payment_solution: Option<String>,
+    commerce_indicator: Option<String>,
+    commerce_indicator_label: Option<String>,
+    ecommerce_indicator: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct IssuerInformation {
+    country: Option<enums::CountryAlpha2>,
+    discretionary_data: Option<String>,
+    country_specific_discretionary_data: Option<String>,
+    response_code: Option<String>,
+    pin_request_indicator: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardResponseObject {
+    suffix: Option<String>,
+    prefix: Option<String>,
+    expiration_month: Option<Secret<String>>,
+    expiration_year: Option<Secret<String>>,
+    #[serde(rename = "type")]
+    card_type: Option<String>,
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BarclaycardErrorInformationResponse {
+    id: String,
+    error_information: BarclaycardErrorInformation,
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize)]
+pub struct BarclaycardErrorInformation {
+    reason: Option<String>,
+    message: Option<String>,
+    details: Option<Vec<Details>>,
+}
+
+fn map_error_response<F, T>(
+    error_response: &BarclaycardErrorInformationResponse,
+    item: ResponseRouterData<F, BarclaycardPaymentsResponse, T, PaymentsResponseData>,
+    transaction_status: Option<enums::AttemptStatus>,
+) -> RouterData<F, T, PaymentsResponseData> {
+    let detailed_error_info = error_response
+        .error_information
+        .details
+        .as_ref()
+        .map(|details| {
+            details
+                .iter()
+                .map(|details| format!("{} : {}", details.field, details.reason))
+                .collect::<Vec<_>>()
+                .join(", ")
+        });
+
+    let reason = get_error_reason(
+        error_response.error_information.message.clone(),
+        detailed_error_info,
+        None,
+    );
+    let response = Err(ErrorResponse {
+        code: error_response
+            .error_information
+            .reason
+            .clone()
+            .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),
+        message: error_response
+            .error_information
+            .reason
+            .clone()
+            .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
+        reason,
+        status_code: item.http_code,
+        attempt_status: None,
+        connector_transaction_id: Some(error_response.id.clone()),
+        network_advice_code: None,
+        network_decline_code: None,
+        network_error_message: None,
+    });
+
+    match transaction_status {
+        Some(status) => RouterData {
+            response,
+            status,
+            ..item.data
+        },
+        None => RouterData {
+            response,
+            ..item.data
+        },
+    }
+}
+
+fn get_error_response_if_failure(
+    (info_response, status, http_code): (
+        &BarclaycardClientReferenceResponse,
+        enums::AttemptStatus,
+        u16,
+    ),
+) -> Option<ErrorResponse> {
+    if utils::is_payment_failure(status) {
+        Some(get_error_response(
+            &info_response.error_information,
+            &info_response.processor_information,
+            &info_response.risk_information,
+            Some(status),
+            http_code,
+            info_response.id.clone(),
+        ))
+    } else {
+        None
+    }
+}
+
+fn get_payment_response(
+    (info_response, status, http_code): (
+        &BarclaycardClientReferenceResponse,
+        enums::AttemptStatus,
+        u16,
+    ),
+) -> Result<PaymentsResponseData, Box<ErrorResponse>> {
+    let error_response = get_error_response_if_failure((info_response, status, http_code));
+    match error_response {
+        Some(error) => Err(Box::new(error)),
+        None => Ok(PaymentsResponseData::TransactionResponse {
+            resource_id: ResponseId::ConnectorTransactionId(info_response.id.clone()),
+            redirection_data: Box::new(None),
+            mandate_reference: Box::new(None),
+            connector_metadata: None,
+            network_txn_id: None,
+            connector_response_reference_id: Some(
+                info_response
+                    .client_reference_information
+                    .code
+                    .clone()
+                    .unwrap_or(info_response.id.clone()),
+            ),
+            incremental_authorization_allowed: None,
+            charges: None,
+        }),
+    }
+}
+
+impl<F>
+    TryFrom<
+        ResponseRouterData<
+            F,
+            BarclaycardPaymentsResponse,
+            PaymentsAuthorizeData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<F, PaymentsAuthorizeData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            BarclaycardPaymentsResponse,
+            PaymentsAuthorizeData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        match item.response {
+            BarclaycardPaymentsResponse::ClientReferenceInformation(info_response) => {
+                let status = map_barclaycard_attempt_status((
+                    info_response.status.clone(),
+                    item.data.request.is_auto_capture()?,
+                ));
+                let response = get_payment_response((&info_response, status, item.http_code))
+                    .map_err(|err| *err);
+                let connector_response = match item.data.payment_method {
+                    common_enums::PaymentMethod::Card => info_response
+                        .processor_information
+                        .as_ref()
+                        .and_then(|processor_information| {
+                            info_response
+                                .consumer_authentication_information
+                                .as_ref()
+                                .map(|consumer_auth_information| {
+                                    convert_to_additional_payment_method_connector_response(
+                                        processor_information,
+                                        consumer_auth_information,
+                                    )
+                                })
+                        })
+                        .map(ConnectorResponseData::with_additional_payment_method_data),
+                    common_enums::PaymentMethod::CardRedirect
+                    | common_enums::PaymentMethod::PayLater
+                    | common_enums::PaymentMethod::Wallet
+                    | common_enums::PaymentMethod::BankRedirect
+                    | common_enums::PaymentMethod::BankTransfer
+                    | common_enums::PaymentMethod::Crypto
+                    | common_enums::PaymentMethod::BankDebit
+                    | common_enums::PaymentMethod::Reward
+                    | common_enums::PaymentMethod::RealTimePayment
+                    | common_enums::PaymentMethod::MobilePayment
+                    | common_enums::PaymentMethod::Upi
+                    | common_enums::PaymentMethod::Voucher
+                    | common_enums::PaymentMethod::OpenBanking
+                    | common_enums::PaymentMethod::GiftCard => None,
                 };
+
                 Ok(Self {
-                    amount: item.amount.clone(),
-                    card,
+                    status,
+                    response,
+                    connector_response,
+                    ..item.data
                 })
             }
-            _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+            BarclaycardPaymentsResponse::ErrorInformation(ref error_response) => {
+                Ok(map_error_response(
+                    &error_response.clone(),
+                    item,
+                    Some(enums::AttemptStatus::Failure),
+                ))
+            }
         }
     }
 }
 
-//TODO: Fill the struct with respective fields
-// Auth Struct
-pub struct BarclaycardAuthType {
-    pub(super) api_key: Secret<String>,
+fn convert_to_additional_payment_method_connector_response(
+    processor_information: &ClientProcessorInformation,
+    consumer_authentication_information: &ConsumerAuthenticationInformation,
+) -> AdditionalPaymentMethodConnectorResponse {
+    let payment_checks = Some(serde_json::json!({
+        "avs_response": processor_information.avs,
+        "card_verification": processor_information.card_verification,
+        "approval_code": processor_information.approval_code,
+        "consumer_authentication_response": processor_information.consumer_authentication_response,
+        "cavv": consumer_authentication_information.cavv,
+        "eci": consumer_authentication_information.eci,
+        "eci_raw": consumer_authentication_information.eci_raw,
+    }));
+
+    let authentication_data = Some(serde_json::json!({
+        "retrieval_reference_number": processor_information.retrieval_reference_number,
+        "acs_transaction_id": consumer_authentication_information.acs_transaction_id,
+        "system_trace_audit_number": processor_information.system_trace_audit_number,
+    }));
+
+    AdditionalPaymentMethodConnectorResponse::Card {
+        authentication_data,
+        payment_checks,
+        card_network: None,
+        domestic_network: None,
+    }
 }
 
-impl TryFrom<&ConnectorAuthType> for BarclaycardAuthType {
+impl<F>
+    TryFrom<
+        ResponseRouterData<
+            F,
+            BarclaycardPaymentsResponse,
+            PaymentsCaptureData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<F, PaymentsCaptureData, PaymentsResponseData>
+{
     type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
-        match auth_type {
-            ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
-                api_key: api_key.to_owned(),
-            }),
-            _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            BarclaycardPaymentsResponse,
+            PaymentsCaptureData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        match item.response {
+            BarclaycardPaymentsResponse::ClientReferenceInformation(info_response) => {
+                let status = map_barclaycard_attempt_status((info_response.status.clone(), true));
+                let response = get_payment_response((&info_response, status, item.http_code))
+                    .map_err(|err| *err);
+                Ok(Self {
+                    status,
+                    response,
+                    ..item.data
+                })
+            }
+            BarclaycardPaymentsResponse::ErrorInformation(ref error_response) => {
+                Ok(map_error_response(&error_response.clone(), item, None))
+            }
         }
     }
 }
-// PaymentsResponse
-//TODO: Append the remaining status flags
-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "lowercase")]
-pub enum BarclaycardPaymentStatus {
-    Succeeded,
-    Failed,
-    #[default]
-    Processing,
-}
 
-impl From<BarclaycardPaymentStatus> for common_enums::AttemptStatus {
-    fn from(item: BarclaycardPaymentStatus) -> Self {
-        match item {
-            BarclaycardPaymentStatus::Succeeded => Self::Charged,
-            BarclaycardPaymentStatus::Failed => Self::Failure,
-            BarclaycardPaymentStatus::Processing => Self::Authorizing,
+impl<F>
+    TryFrom<
+        ResponseRouterData<
+            F,
+            BarclaycardPaymentsResponse,
+            PaymentsCancelData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<F, PaymentsCancelData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            BarclaycardPaymentsResponse,
+            PaymentsCancelData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        match item.response {
+            BarclaycardPaymentsResponse::ClientReferenceInformation(info_response) => {
+                let status = map_barclaycard_attempt_status((info_response.status.clone(), false));
+                let response = get_payment_response((&info_response, status, item.http_code))
+                    .map_err(|err| *err);
+                Ok(Self {
+                    status,
+                    response,
+                    ..item.data
+                })
+            }
+            BarclaycardPaymentsResponse::ErrorInformation(ref error_response) => {
+                Ok(map_error_response(&error_response.clone(), item, None))
+            }
         }
     }
 }
 
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct BarclaycardPaymentsResponse {
-    status: BarclaycardPaymentStatus,
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BarclaycardTransactionResponse {
     id: String,
+    application_information: ApplicationInformation,
+    client_reference_information: Option<ClientReferenceInformation>,
+    processor_information: Option<ClientProcessorInformation>,
+    processing_information: Option<ProcessingInformationResponse>,
+    payment_information: Option<PaymentInformationResponse>,
+    payment_insights_information: Option<PaymentInsightsInformation>,
+    error_information: Option<BarclaycardErrorInformation>,
+    fraud_marking_information: Option<FraudMarkingInformation>,
+    risk_information: Option<ClientRiskInformation>,
+    reconciliation_id: Option<String>,
+    consumer_authentication_information: Option<ConsumerAuthenticationInformation>,
 }
 
-impl<F, T> TryFrom<ResponseRouterData<F, BarclaycardPaymentsResponse, T, PaymentsResponseData>>
-    for RouterData<F, T, PaymentsResponseData>
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FraudMarkingInformation {
+    reason: Option<String>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApplicationInformation {
+    status: Option<BarclaycardPaymentStatus>,
+}
+
+impl<F>
+    TryFrom<
+        ResponseRouterData<
+            F,
+            BarclaycardTransactionResponse,
+            PaymentsSyncData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<F, PaymentsSyncData, PaymentsResponseData>
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: ResponseRouterData<F, BarclaycardPaymentsResponse, T, PaymentsResponseData>,
+        item: ResponseRouterData<
+            F,
+            BarclaycardTransactionResponse,
+            PaymentsSyncData,
+            PaymentsResponseData,
+        >,
     ) -> Result<Self, Self::Error> {
-        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,
+        match item.response.application_information.status {
+            Some(app_status) => {
+                let status = map_barclaycard_attempt_status((
+                    app_status,
+                    item.data.request.is_auto_capture()?,
+                ));
+
+                let connector_response = match item.data.payment_method {
+                    common_enums::PaymentMethod::Card => item
+                        .response
+                        .processor_information
+                        .as_ref()
+                        .and_then(|processor_information| {
+                            item.response
+                                .consumer_authentication_information
+                                .as_ref()
+                                .map(|consumer_auth_information| {
+                                    convert_to_additional_payment_method_connector_response(
+                                        processor_information,
+                                        consumer_auth_information,
+                                    )
+                                })
+                        })
+                        .map(ConnectorResponseData::with_additional_payment_method_data),
+                    common_enums::PaymentMethod::CardRedirect
+                    | common_enums::PaymentMethod::PayLater
+                    | common_enums::PaymentMethod::Wallet
+                    | common_enums::PaymentMethod::BankRedirect
+                    | common_enums::PaymentMethod::BankTransfer
+                    | common_enums::PaymentMethod::Crypto
+                    | common_enums::PaymentMethod::BankDebit
+                    | common_enums::PaymentMethod::Reward
+                    | common_enums::PaymentMethod::RealTimePayment
+                    | common_enums::PaymentMethod::MobilePayment
+                    | common_enums::PaymentMethod::Upi
+                    | common_enums::PaymentMethod::Voucher
+                    | common_enums::PaymentMethod::OpenBanking
+                    | common_enums::PaymentMethod::GiftCard => None,
+                };
+
+                let risk_info: Option<ClientRiskInformation> = None;
+                if utils::is_payment_failure(status) {
+                    Ok(Self {
+                        response: Err(get_error_response(
+                            &item.response.error_information,
+                            &item.response.processor_information,
+                            &risk_info,
+                            Some(status),
+                            item.http_code,
+                            item.response.id.clone(),
+                        )),
+                        status: enums::AttemptStatus::Failure,
+                        connector_response,
+                        ..item.data
+                    })
+                } else {
+                    Ok(Self {
+                        status,
+                        response: Ok(PaymentsResponseData::TransactionResponse {
+                            resource_id: ResponseId::ConnectorTransactionId(
+                                item.response.id.clone(),
+                            ),
+                            redirection_data: Box::new(None),
+                            mandate_reference: Box::new(None),
+                            connector_metadata: None,
+                            network_txn_id: None,
+                            connector_response_reference_id: item
+                                .response
+                                .client_reference_information
+                                .map(|cref| cref.code)
+                                .unwrap_or(Some(item.response.id)),
+                            incremental_authorization_allowed: None,
+                            charges: None,
+                        }),
+                        connector_response,
+                        ..item.data
+                    })
+                }
+            }
+            None => Ok(Self {
+                status: item.data.status,
+                response: Ok(PaymentsResponseData::TransactionResponse {
+                    resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()),
+                    redirection_data: Box::new(None),
+                    mandate_reference: Box::new(None),
+                    connector_metadata: None,
+                    network_txn_id: None,
+                    connector_response_reference_id: Some(item.response.id),
+                    incremental_authorization_allowed: None,
+                    charges: None,
+                }),
+                ..item.data
             }),
-            ..item.data
+        }
+    }
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct OrderInformation {
+    amount_details: Amount,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BarclaycardCaptureRequest {
+    order_information: OrderInformation,
+    client_reference_information: ClientReferenceInformation,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    merchant_defined_information: Option<Vec<MerchantDefinedInformation>>,
+}
+
+impl TryFrom<&BarclaycardRouterData<&PaymentsCaptureRouterData>> for BarclaycardCaptureRequest {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        value: &BarclaycardRouterData<&PaymentsCaptureRouterData>,
+    ) -> Result<Self, Self::Error> {
+        let merchant_defined_information = value
+            .router_data
+            .request
+            .metadata
+            .clone()
+            .map(convert_metadata_to_merchant_defined_info);
+        Ok(Self {
+            order_information: OrderInformation {
+                amount_details: Amount {
+                    total_amount: value.amount.to_owned(),
+                    currency: value.router_data.request.currency,
+                },
+            },
+            client_reference_information: ClientReferenceInformation {
+                code: Some(value.router_data.connector_request_reference_id.clone()),
+            },
+            merchant_defined_information,
         })
     }
 }
 
-//TODO: Fill the struct with respective fields
-// REFUND :
-// Type definition for RefundRequest
-#[derive(Default, Debug, Serialize)]
-pub struct BarclaycardRefundRequest {
-    pub amount: StringMinorUnit,
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BarclaycardVoidRequest {
+    client_reference_information: ClientReferenceInformation,
+    reversal_information: ReversalInformation,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    merchant_defined_information: Option<Vec<MerchantDefinedInformation>>,
+    // The connector documentation does not mention the merchantDefinedInformation field for Void requests. But this has been still added because it works!
 }
 
-impl<F> TryFrom<&BarclaycardRouterData<&RefundsRouterData<F>>> for BarclaycardRefundRequest {
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ReversalInformation {
+    amount_details: Amount,
+    reason: String,
+}
+
+impl TryFrom<&BarclaycardRouterData<&PaymentsCancelRouterData>> for BarclaycardVoidRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(item: &BarclaycardRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+    fn try_from(
+        value: &BarclaycardRouterData<&PaymentsCancelRouterData>,
+    ) -> Result<Self, Self::Error> {
+        let merchant_defined_information = value
+            .router_data
+            .request
+            .metadata
+            .clone()
+            .map(convert_metadata_to_merchant_defined_info);
         Ok(Self {
-            amount: item.amount.to_owned(),
+            client_reference_information: ClientReferenceInformation {
+                code: Some(value.router_data.connector_request_reference_id.clone()),
+            },
+            reversal_information: ReversalInformation {
+                amount_details: Amount {
+                    total_amount: value.amount.to_owned(),
+                    currency: value.router_data.request.currency.ok_or(
+                        errors::ConnectorError::MissingRequiredField {
+                            field_name: "Currency",
+                        },
+                    )?,
+                },
+                reason: value
+                    .router_data
+                    .request
+                    .cancellation_reason
+                    .clone()
+                    .ok_or(errors::ConnectorError::MissingRequiredField {
+                        field_name: "Cancellation Reason",
+                    })?,
+            },
+            merchant_defined_information,
         })
     }
 }
 
-// Type definition for Refund Response
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BarclaycardRefundRequest {
+    order_information: OrderInformation,
+    client_reference_information: ClientReferenceInformation,
+}
 
-#[allow(dead_code)]
-#[derive(Debug, Serialize, Default, Deserialize, Clone)]
-pub enum RefundStatus {
-    Succeeded,
-    Failed,
-    #[default]
-    Processing,
+impl<F> TryFrom<&BarclaycardRouterData<&RefundsRouterData<F>>> for BarclaycardRefundRequest {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(item: &BarclaycardRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+        Ok(Self {
+            order_information: OrderInformation {
+                amount_details: Amount {
+                    total_amount: item.amount.clone(),
+                    currency: item.router_data.request.currency,
+                },
+            },
+            client_reference_information: ClientReferenceInformation {
+                code: Some(item.router_data.request.refund_id.clone()),
+            },
+        })
+    }
 }
 
-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
+impl From<BarclaycardRefundResponse> for enums::RefundStatus {
+    fn from(item: BarclaycardRefundResponse) -> Self {
+        let error_reason = item
+            .error_information
+            .and_then(|error_info| error_info.reason);
+        match item.status {
+            BarclaycardRefundStatus::Succeeded | BarclaycardRefundStatus::Transmitted => {
+                Self::Success
+            }
+            BarclaycardRefundStatus::Cancelled
+            | BarclaycardRefundStatus::Failed
+            | BarclaycardRefundStatus::Voided => Self::Failure,
+            BarclaycardRefundStatus::Pending => Self::Pending,
+            BarclaycardRefundStatus::TwoZeroOne => {
+                if error_reason == Some("PROCESSOR_DECLINED".to_string()) {
+                    Self::Failure
+                } else {
+                    Self::Pending
+                }
+            }
         }
     }
 }
 
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize)]
-pub struct RefundResponse {
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BarclaycardRefundResponse {
     id: String,
-    status: RefundStatus,
+    status: BarclaycardRefundStatus,
+    error_information: Option<BarclaycardErrorInformation>,
 }
 
-impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+impl TryFrom<RefundsResponseRouterData<Execute, BarclaycardRefundResponse>>
+    for RefundsRouterData<Execute>
+{
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: RefundsResponseRouterData<Execute, RefundResponse>,
+        item: RefundsResponseRouterData<Execute, BarclaycardRefundResponse>,
     ) -> Result<Self, Self::Error> {
+        let refund_status = enums::RefundStatus::from(item.response.clone());
+        let response = if utils::is_refund_failure(refund_status) {
+            Err(get_error_response(
+                &item.response.error_information,
+                &None,
+                &None,
+                None,
+                item.http_code,
+                item.response.id,
+            ))
+        } else {
+            Ok(RefundsResponseData {
+                connector_refund_id: item.response.id,
+                refund_status,
+            })
+        };
+
         Ok(Self {
-            response: Ok(RefundsResponseData {
-                connector_refund_id: item.response.id.to_string(),
-                refund_status: enums::RefundStatus::from(item.response.status),
-            }),
+            response,
             ..item.data
         })
     }
 }
 
-impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum BarclaycardRefundStatus {
+    Succeeded,
+    Transmitted,
+    Failed,
+    Pending,
+    Voided,
+    Cancelled,
+    #[serde(rename = "201")]
+    TwoZeroOne,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RsyncApplicationInformation {
+    status: Option<BarclaycardRefundStatus>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BarclaycardRsyncResponse {
+    id: String,
+    application_information: Option<RsyncApplicationInformation>,
+    error_information: Option<BarclaycardErrorInformation>,
+}
+
+impl TryFrom<RefundsResponseRouterData<RSync, BarclaycardRsyncResponse>>
+    for RefundsRouterData<RSync>
+{
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: RefundsResponseRouterData<RSync, RefundResponse>,
+        item: RefundsResponseRouterData<RSync, BarclaycardRsyncResponse>,
     ) -> 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),
+        let response = match item
+            .response
+            .application_information
+            .and_then(|application_information| application_information.status)
+        {
+            Some(status) => {
+                let error_reason = item
+                    .response
+                    .error_information
+                    .clone()
+                    .and_then(|error_info| error_info.reason);
+                let refund_status = match status {
+                    BarclaycardRefundStatus::Succeeded | BarclaycardRefundStatus::Transmitted => {
+                        enums::RefundStatus::Success
+                    }
+                    BarclaycardRefundStatus::Cancelled
+                    | BarclaycardRefundStatus::Failed
+                    | BarclaycardRefundStatus::Voided => enums::RefundStatus::Failure,
+                    BarclaycardRefundStatus::Pending => enums::RefundStatus::Pending,
+                    BarclaycardRefundStatus::TwoZeroOne => {
+                        if error_reason == Some("PROCESSOR_DECLINED".to_string()) {
+                            enums::RefundStatus::Failure
+                        } else {
+                            enums::RefundStatus::Pending
+                        }
+                    }
+                };
+                if utils::is_refund_failure(refund_status) {
+                    if status == BarclaycardRefundStatus::Voided {
+                        Err(get_error_response(
+                            &Some(BarclaycardErrorInformation {
+                                message: Some(constants::REFUND_VOIDED.to_string()),
+                                reason: Some(constants::REFUND_VOIDED.to_string()),
+                                details: None,
+                            }),
+                            &None,
+                            &None,
+                            None,
+                            item.http_code,
+                            item.response.id.clone(),
+                        ))
+                    } else {
+                        Err(get_error_response(
+                            &item.response.error_information,
+                            &None,
+                            &None,
+                            None,
+                            item.http_code,
+                            item.response.id.clone(),
+                        ))
+                    }
+                } else {
+                    Ok(RefundsResponseData {
+                        connector_refund_id: item.response.id,
+                        refund_status,
+                    })
+                }
+            }
+
+            None => Ok(RefundsResponseData {
+                connector_refund_id: item.response.id.clone(),
+                refund_status: match item.data.response {
+                    Ok(response) => response.refund_status,
+                    Err(_) => common_enums::RefundStatus::Pending,
+                },
             }),
+        };
+
+        Ok(Self {
+            response,
             ..item.data
         })
     }
 }
 
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
-pub struct BarclaycardErrorResponse {
-    pub status_code: u16,
-    pub code: String,
-    pub message: String,
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BarclaycardStandardErrorResponse {
+    pub error_information: Option<ErrorInformation>,
+    pub status: Option<String>,
+    pub message: Option<String>,
     pub reason: Option<String>,
+    pub details: Option<Vec<Details>>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BarclaycardServerErrorResponse {
+    pub status: Option<String>,
+    pub message: Option<String>,
+    pub reason: Option<Reason>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum Reason {
+    SystemError,
+    ServerTimeout,
+    ServiceTimeout,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+pub struct BarclaycardAuthenticationErrorResponse {
+    pub response: AuthenticationErrorInformation,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum BarclaycardErrorResponse {
+    AuthenticationError(BarclaycardAuthenticationErrorResponse),
+    StandardError(BarclaycardStandardErrorResponse),
+}
+
+#[derive(Debug, Deserialize, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Details {
+    pub field: String,
+    pub reason: String,
+}
+
+#[derive(Debug, Default, Deserialize, Serialize)]
+pub struct ErrorInformation {
+    pub message: String,
+    pub reason: String,
+    pub details: Option<Vec<Details>>,
+}
+
+#[derive(Debug, Default, Deserialize, Serialize)]
+pub struct AuthenticationErrorInformation {
+    pub rmsg: String,
+}
+
+fn get_error_response(
+    error_data: &Option<BarclaycardErrorInformation>,
+    processor_information: &Option<ClientProcessorInformation>,
+    risk_information: &Option<ClientRiskInformation>,
+    attempt_status: Option<enums::AttemptStatus>,
+    status_code: u16,
+    transaction_id: String,
+) -> ErrorResponse {
+    let avs_message = risk_information
+        .clone()
+        .map(|client_risk_information| {
+            client_risk_information.rules.map(|rules| {
+                rules
+                    .iter()
+                    .map(|risk_info| {
+                        risk_info.name.clone().map_or("".to_string(), |name| {
+                            format!(" , {}", name.clone().expose())
+                        })
+                    })
+                    .collect::<Vec<String>>()
+                    .join("")
+            })
+        })
+        .unwrap_or(Some("".to_string()));
+
+    let detailed_error_info = error_data.to_owned().and_then(|error_info| {
+        error_info.details.map(|error_details| {
+            error_details
+                .iter()
+                .map(|details| format!("{} : {}", details.field, details.reason))
+                .collect::<Vec<_>>()
+                .join(", ")
+        })
+    });
+    let network_decline_code = processor_information
+        .as_ref()
+        .and_then(|info| info.response_code.clone());
+    let network_advice_code = processor_information.as_ref().and_then(|info| {
+        info.merchant_advice
+            .as_ref()
+            .and_then(|merchant_advice| merchant_advice.code_raw.clone())
+    });
+
+    let reason = get_error_reason(
+        error_data
+            .clone()
+            .and_then(|error_details| error_details.message),
+        detailed_error_info,
+        avs_message,
+    );
+    let error_message = error_data
+        .clone()
+        .and_then(|error_details| error_details.reason);
+
+    ErrorResponse {
+        code: error_message
+            .clone()
+            .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),
+        message: error_message
+            .clone()
+            .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
+        reason,
+        status_code,
+        attempt_status,
+        connector_transaction_id: Some(transaction_id.clone()),
+        network_advice_code,
+        network_decline_code,
+        network_error_message: None,
+    }
+}
+
+impl TryFrom<&hyperswitch_domain_models::payment_method_data::Card> for PaymentInformation {
+    type Error = error_stack::Report<errors::ConnectorError>;
+
+    fn try_from(
+        ccard: &hyperswitch_domain_models::payment_method_data::Card,
+    ) -> Result<Self, Self::Error> {
+        let card_type = match ccard
+            .card_network
+            .clone()
+            .and_then(get_barclaycard_card_type)
+        {
+            Some(card_network) => Some(card_network.to_string()),
+            None => ccard.get_card_issuer().ok().map(String::from),
+        };
+        Ok(Self::Cards(Box::new(CardPaymentInformation {
+            card: Card {
+                number: ccard.card_number.clone(),
+                expiration_month: ccard.card_exp_month.clone(),
+                expiration_year: ccard.card_exp_year.clone(),
+                security_code: ccard.card_cvc.clone(),
+                card_type,
+            },
+        })))
+    }
+}
+
+fn get_commerce_indicator(network: Option<String>) -> String {
+    match network {
+        Some(card_network) => match card_network.to_lowercase().as_str() {
+            "amex" => "aesk",
+            "discover" => "dipb",
+            "mastercard" => "spa",
+            "visa" => "internet",
+            _ => "internet",
+        },
+        None => "internet",
+    }
+    .to_string()
+}
+
+pub fn get_error_reason(
+    error_info: Option<String>,
+    detailed_error_info: Option<String>,
+    avs_error_info: Option<String>,
+) -> Option<String> {
+    match (error_info, detailed_error_info, avs_error_info) {
+        (Some(message), Some(details), Some(avs_message)) => Some(format!(
+            "{}, detailed_error_information: {}, avs_message: {}",
+            message, details, avs_message
+        )),
+        (Some(message), Some(details), None) => Some(format!(
+            "{}, detailed_error_information: {}",
+            message, details
+        )),
+        (Some(message), None, Some(avs_message)) => {
+            Some(format!("{}, avs_message: {}", message, avs_message))
+        }
+        (None, Some(details), Some(avs_message)) => {
+            Some(format!("{}, avs_message: {}", details, avs_message))
+        }
+        (Some(message), None, None) => Some(message),
+        (None, Some(details), None) => Some(details),
+        (None, None, Some(avs_message)) => Some(avs_message),
+        (None, None, None) => None,
+    }
 }
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 860d82ab487..8e31533d5f9 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1379,10 +1379,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
                 bankofamerica::transformers::BankOfAmericaAuthType::try_from(self.auth_type)?;
                 Ok(())
             }
-            // api_enums::Connector::Barclaycard => {
-            //     barclaycard::transformers::BarclaycardAuthType::try_from(self.auth_type)?;
-            //     Ok(())
-            // },
+            api_enums::Connector::Barclaycard => {
+                barclaycard::transformers::BarclaycardAuthType::try_from(self.auth_type)?;
+                Ok(())
+            }
             api_enums::Connector::Billwerk => {
                 billwerk::transformers::BillwerkAuthType::try_from(self.auth_type)?;
                 Ok(())
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 25e6fde8b33..8592753ae91 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -352,9 +352,9 @@ impl ConnectorData {
                 enums::Connector::Bankofamerica => {
                     Ok(ConnectorEnum::Old(Box::new(&connector::Bankofamerica)))
                 }
-                // enums::Connector::Barclaycard => {
-                //     Ok(ConnectorEnum::Old(Box::new(connector::Barclaycard)))
-                // }
+                enums::Connector::Barclaycard => {
+                    Ok(ConnectorEnum::Old(Box::new(&connector::Barclaycard)))
+                }
                 enums::Connector::Billwerk => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Billwerk::new())))
                 }
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index e2ff8e3941e..566c9d83961 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -219,7 +219,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
             api_enums::Connector::Bambora => Self::Bambora,
             api_enums::Connector::Bamboraapac => Self::Bamboraapac,
             api_enums::Connector::Bankofamerica => Self::Bankofamerica,
-            // api_enums::Connector::Barclaycard => Self::Barclaycard,
+            api_enums::Connector::Barclaycard => Self::Barclaycard,
             api_enums::Connector::Billwerk => Self::Billwerk,
             api_enums::Connector::Bitpay => Self::Bitpay,
             api_enums::Connector::Bluesnap => Self::Bluesnap,
diff --git a/crates/router/tests/connectors/barclaycard.rs b/crates/router/tests/connectors/barclaycard.rs
index 2087131c4e6..c2c21bbcc08 100644
--- a/crates/router/tests/connectors/barclaycard.rs
+++ b/crates/router/tests/connectors/barclaycard.rs
@@ -11,7 +11,7 @@ impl utils::Connector for BarclaycardTest {
     fn get_data(&self) -> api::ConnectorData {
         use router::connector::Barclaycard;
         utils::construct_connector_data_old(
-            Box::new(Barclaycard::new()),
+            Box::new(&Barclaycard),
             types::Connector::DummyConnector1,
             api::GetToken::Connector,
             None,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index d3edab05109..06f967fba7c 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -86,7 +86,7 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
 bambora.base_url = "https://api.na.bambora.com"
 bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api"
 bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/"
-barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/pts/v2/"
+barclaycard.base_url = "https://api.smartpayfuse-test.barclaycard/"
 billwerk.base_url = "https://api.reepay.com/"
 billwerk.secondary_base_url = "https://card.reepay.com/"
 bitpay.base_url = "https://test.bitpay.com"

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

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

Closes this [issue](https://github.com/juspay/hyperswitch/issues/8067)

## Description
<!-- Describe your changes in detail -->

Added Authorize, Capture, Void, Refund, PSync and RSync flow for cards payment method for Barclaycard. Also added connector specifications for the same connector.

### 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).
-->


## 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)?
-->

Postman Tests

1. Payment Connector - Create

Request:

```
curl --location 'http://localhost:8080/account/merchant_1747726068/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: ••••••' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_account_details": {
        "auth_type": auth_type,
        "api_secret": api_secret,
        "api_key": api_key,
        "key1": key1
    },
    "test_mode": false,
    "disabled": false,
    "business_country": "US",
    "business_label": "default",
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ]
}'
```

Response:

```
{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_label": "barclaycard_US_default",
    "merchant_connector_id": "mca_BSrgu17zDqS7EXYvqz9O",
    "profile_id": "pro_pehtYfNAEJUejck1GkP6",
    "connector_account_details": {
        "auth_type": auth_type,
        "api_key": "************************************",
        "key1": "*****************",
        "api_secret": "********************************************"
    },
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "connector_webhook_details": null,
    "metadata": null,
    "test_mode": false,
    "disabled": false,
    "frm_configs": null,
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": null
}
```

2. Payments - Create

Request:

```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "customer_123",
    "email": "guest@example.com",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4347699988887777",
            "card_exp_month": "1",
            "card_exp_year": "26",
            "card_holder_name": "joseph Doe",
            "card_cvc": "555"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country":"US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    }
}'
```

Response:

```
{
    "payment_id": "pay_U1YF8Oy30dykRHfSzRLz",
    "merchant_id": "merchant_1747726068",
    "status": "succeeded",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6540,
    "connector": "barclaycard",
    "client_secret": "pay_U1YF8Oy30dykRHfSzRLz_secret_9BQZ2PGg3e7ZIeIT6BAq",
    "created": "2025-05-20T07:31:28.562Z",
    "currency": "USD",
    "customer_id": "customer_123",
    "customer": {
        "id": "customer_123",
        "name": null,
        "email": "guest@example.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7777",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "434769",
            "card_extended_bin": null,
            "card_exp_month": "1",
            "card_exp_year": "26",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "eci": null,
                "cavv": null,
                "eci_raw": null,
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "approval_code": "831000",
                "card_verification": {
                    "resultCode": "M",
                    "resultCodeRaw": "M"
                },
                "consumer_authentication_response": {
                    "code": "2",
                    "codeRaw": "2"
                }
            },
            "authentication_data": {
                "acs_transaction_id": null,
                "system_trace_audit_number": "149277",
                "retrieval_reference_number": "514007149277"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "customer_123",
        "created_at": 1747726288,
        "expires": 1747729888,
        "secret": "epk_8d2cca87e0544416b980cee5bb5a1ab3"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7477262936786891604805",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_U1YF8Oy30dykRHfSzRLz_1",
    "payment_link": null,
    "profile_id": "pro_pehtYfNAEJUejck1GkP6",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_BSrgu17zDqS7EXYvqz9O",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-05-20T07:46:28.562Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-05-20T07:31:34.524Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```

3. Payments - Retrieve

Request:

```
curl --location 'http://localhost:8080/payments/pay_U1YF8Oy30dykRHfSzRLz?expand_captures=true&expand_attempts=true&all_keys_required=true&force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_zH1HhEd5Y4Nybo7VUkUC55IO7p9hNkJPiSSuBTBuLLWzhn7CsNdR5jZEyXzP41b1'
```

Response:

```
{
    "payment_id": "pay_U1YF8Oy30dykRHfSzRLz",
    "merchant_id": "merchant_1747726068",
    "status": "succeeded",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6540,
    "connector": "barclaycard",
    "client_secret": "pay_U1YF8Oy30dykRHfSzRLz_secret_9BQZ2PGg3e7ZIeIT6BAq",
    "created": "2025-05-20T07:31:28.562Z",
    "currency": "USD",
    "customer_id": "customer_123",
    "customer": {
        "id": "customer_123",
        "name": null,
        "email": "guest@example.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_U1YF8Oy30dykRHfSzRLz_1",
            "status": "charged",
            "amount": 6540,
            "order_tax_amount": null,
            "currency": "USD",
            "connector": "barclaycard",
            "error_message": null,
            "payment_method": "card",
            "connector_transaction_id": "7477262936786891604805",
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2025-05-20T07:31:28.562Z",
            "modified_at": "2025-05-20T07:31:34.524Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": null,
            "reference_id": "pay_U1YF8Oy30dykRHfSzRLz_1",
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7777",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "434769",
            "card_extended_bin": null,
            "card_exp_month": "1",
            "card_exp_year": "26",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "eci": null,
                "cavv": null,
                "eci_raw": null,
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "approval_code": "831000",
                "card_verification": {
                    "resultCode": "M",
                    "resultCodeRaw": "M"
                },
                "consumer_authentication_response": {
                    "code": "2",
                    "codeRaw": "2"
                }
            },
            "authentication_data": {
                "acs_transaction_id": null,
                "system_trace_audit_number": "149277",
                "retrieval_reference_number": "514007149277"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7477262936786891604805",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_U1YF8Oy30dykRHfSzRLz_1",
    "payment_link": null,
    "profile_id": "pro_pehtYfNAEJUejck1GkP6",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_BSrgu17zDqS7EXYvqz9O",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-05-20T07:46:28.562Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-05-20T07:33:57.427Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": "{\"id\":\"7477262936786891604805\",\"rootId\":\"7477262936786891604805\",\"reconciliationId\":\"7477262936786891604805\",\"submitTimeUTC\":\"2025-05-20T07:31:33Z\",\"merchantId\":\"juspay_us_sandbox\",\"applicationInformation\":{\"status\":\"PENDING\",\"reasonCode\":100,\"applications\":[{\"name\":\"ics_auth\",\"reasonCode\":\"100\",\"rCode\":\"1\",\"rFlag\":\"SOK\",\"reconciliationId\":\"7477262936786891604805\",\"rMessage\":\"Request was processed successfully.\",\"returnCode\":1010000},{\"name\":\"ics_bill\",\"status\":\"PENDING\",\"reasonCode\":\"100\",\"rCode\":\"1\",\"rFlag\":\"SOK\",\"reconciliationId\":\"7477262936786891604805\",\"rMessage\":\"Request was processed successfully.\",\"returnCode\":1260000},{\"name\":\"ics_decision\",\"reasonCode\":\"100\",\"rCode\":\"1\",\"rFlag\":\"SOK\",\"rMessage\":\"Service processed successfully\",\"returnCode\":1320000},{\"name\":\"ics_decision_early\",\"reasonCode\":\"100\",\"rCode\":\"1\",\"returnCode\":9999999}]},\"buyerInformation\":{},\"clientReferenceInformation\":{\"code\":\"pay_U1YF8Oy30dykRHfSzRLz_1\",\"applicationName\":\"REST API\",\"applicationVersion\":\"1.0\",\"partner\":{}},\"consumerAuthenticationInformation\":{\"eciRaw\":\"7\",\"strongAuthentication\":{}},\"deviceInformation\":{},\"errorInformation\":{\"message\":\"Request was processed successfully.\"},\"installmentInformation\":{},\"fraudMarkingInformation\":{},\"merchantDefinedInformation\":[{\"key\":\"1\",\"value\":\"login_date=\\\"2019-09-10T10:11:12Z\\\"\"},{\"key\":\"2\",\"value\":\"new_customer=\\\"true\\\"\"},{\"key\":\"3\",\"value\":\"udf1=\\\"value1\\\"\"}],\"merchantInformation\":{\"merchantDescriptor\":{\"name\":\"juspay_us_sandbox\"}},\"orderInformation\":{\"billTo\":{\"firstName\":\"JOSEPH\",\"lastName\":\"DOE\",\"address1\":\"1467\",\"locality\":\"San Fransico\",\"administrativeArea\":\"CA\",\"postalCode\":\"94122\",\"email\":\"guest@example.com\",\"country\":\"US\"},\"shipTo\":{},\"amountDetails\":{\"totalAmount\":\"65.4\",\"currency\":\"USD\",\"taxAmount\":\"0\",\"authorizedAmount\":\"65.4\"},\"shippingDetails\":{},\"invoiceDetails\":{},\"lineItems\":[{\"productCode\":\"default\",\"taxAmount\":0,\"quantity\":1,\"unitPrice\":65.4}]},\"paymentInformation\":{\"customer\":{},\"paymentInstrument\":{},\"instrumentIdentifier\":{},\"shippingAddress\":{},\"paymentType\":{\"name\":\"vdcvantiv\",\"type\":\"credit card\",\"method\":\"VI\"},\"card\":{\"suffix\":\"7777\",\"prefix\":\"434769\",\"expirationMonth\":\"1 \",\"expirationYear\":\"26  \",\"type\":\"001\"},\"invoice\":{},\"accountFeatures\":{},\"fluidData\":{},\"issuerInformation\":{\"country\":\"US\"},\"paymentAccountInformation\":{\"card\":{},\"features\":{},\"network\":{}}},\"paymentInsightsInformation\":{\"responseInsights\":{},\"ruleResults\":{}},\"payoutInformation\":{\"pushFunds\":{},\"pullFunds\":{}},\"payoutOptions\":{},\"processingInformation\":{\"paymentSolution\":\"Visa\",\"commerceIndicator\":\"7\",\"commerceIndicatorLabel\":\"internet\",\"authorizationOptions\":{\"authType\":\"O\",\"initiator\":{\"merchantInitiatedTransaction\":{}},\"cardVerificationIndicator\":false},\"bankTransferOptions\":{},\"japanPaymentOptions\":{},\"fundingOptions\":{\"firstRecurringPayment\":false},\"ecommerceIndicator\":\"7\",\"reconciliationId\":\"7477262936786891604805\",\"captureOptions\":{}},\"processorInformation\":{\"processor\":{\"name\":\"vdcvantiv\"},\"networkTransactionId\":\"016153570198200\",\"approvalCode\":\"831000\",\"responseCode\":\"00\",\"avs\":{\"code\":\"Y\",\"codeRaw\":\"Y\"},\"cardVerification\":{\"resultCode\":\"M\"},\"achVerification\":{\"resultCodeRaw\":\"00\"},\"electronicVerificationResults\":{},\"systemTraceAuditNumber\":\"149277\",\"eventStatus\":\"Pending\",\"retrievalReferenceNumber\":\"514007149277\"},\"pointOfSaleInformation\":{},\"riskInformation\":{\"profile\":{\"name\":\"Standard mid-market profile\",\"decision\":\"ACCEPT\"},\"rules\":[{\"name\":\"Fraud Score - Monitor\",\"decision\":\"IGNORE\"},{\"name\":\"Fraud Score - Reject\",\"decision\":\"IGNORE\"},{\"name\":\"Fraud Score - Review\",\"decision\":\"IGNORE\"},{\"name\":\"Invalid Address\",\"decision\":\"IGNORE\"}],\"score\":{\"factorCodes\":[\"H\",\"P\"],\"result\":3}},\"recipientInformation\":{},\"senderInformation\":{\"account\":{},\"paymentInformation\":{\"customer\":{},\"paymentType\":{\"name\":\"vdcvantiv\",\"type\":\"credit card\",\"method\":\"VI\"},\"card\":{\"suffix\":\"7777\",\"expirationMonth\":\"1 \",\"expirationYear\":\"26  \",\"type\":\"001\"},\"invoice\":{},\"accountFeatures\":{},\"fluidData\":{},\"issuerInformation\":{},\"paymentAccountInformation\":{}}},\"tokenInformation\":{},\"_links\":{\"self\":{\"href\":\"https://api.smartpayfuse-test.barclaycard/tss/v2/transactions/7477262936786891604805\",\"method\":\"GET\"}},\"recurringPaymentInformation\":{},\"unscheduledPaymentInformation\":{}}"
}
```

4. Refunds - Create

Request:

```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data '{
    "payment_id": "pay_U1YF8Oy30dykRHfSzRLz",
    "amount": 6540,
    "reason": "Customer returned product",
    "refund_type": "instant"  
}'
```

Response:

```
{
    "refund_id": "ref_9KXjMEdZ4PZDcFWAwNmC",
    "payment_id": "pay_U1YF8Oy30dykRHfSzRLz",
    "amount": 6540,
    "currency": "USD",
    "status": "pending",
    "reason": "Customer returned product",
    "metadata": null,
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-05-20T07:35:51.909Z",
    "updated_at": "2025-05-20T07:35:53.786Z",
    "connector": "barclaycard",
    "profile_id": "pro_pehtYfNAEJUejck1GkP6",
    "merchant_connector_id": "mca_BSrgu17zDqS7EXYvqz9O",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
```

5. Refunds - Retrieve

Request:

```
curl --location 'http://localhost:8080/refunds/ref_9KXjMEdZ4PZDcFWAwNmC' \
--header 'Accept: application/json' \
--header 'api-key: api-key'
```

Response:

```
{
    "refund_id": "ref_9KXjMEdZ4PZDcFWAwNmC",
    "payment_id": "pay_U1YF8Oy30dykRHfSzRLz",
    "amount": 6540,
    "currency": "USD",
    "status": "pending",
    "reason": "Customer returned product",
    "metadata": null,
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-05-20T07:35:51.909Z",
    "updated_at": "2025-05-20T07:37:20.756Z",
    "connector": "barclaycard",
    "profile_id": "pro_pehtYfNAEJUejck1GkP6",
    "merchant_connector_id": "mca_BSrgu17zDqS7EXYvqz9O",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
```

6. Feature Matrix

Request:

```
curl --location 'http://localhost:8080/feature_matrix' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key'
```

Response:

```
{
    "connector_count": 1,
    "connectors": [
        {
            "name": "BARCLAYCARD",
            "display_name": "BarclayCard SmartPay Fuse",
            "description": "Barclaycard, part of Barclays Bank UK PLC, is a leading global payment business that helps consumers, retailers and businesses to make and take payments flexibly, and to access short-term credit and point of sale finance.",
            "category": "bank_acquirer",
            "supported_payment_methods": [
                {
                    "payment_method": "card",
                    "payment_method_type": "credit",
                    "payment_method_type_display_name": "Credit Card",
                    "mandates": "not_supported",
                    "refunds": "supported",
                    "supported_capture_methods": [
                        "automatic",
                        "manual",
                        "sequential_automatic"
                    ],
                    "three_ds": "not_supported",
                    "no_three_ds": "supported",
                    "supported_card_networks": [
                        "Mastercard",
                        "Visa",
                        "AmericanExpress",
                        "JCB",
                        "Discover",
                        "Maestro",
                        "Interac",
                        "DinersClub",
                        "CartesBancaires",
                        "UnionPay"
                    ],
                    "supported_countries": null,
                    "supported_currencies": null,
                },
                {
                    "payment_method": "card",
                    "payment_method_type": "debit",
                    "payment_method_type_display_name": "Debit Card",
                    "mandates": "not_supported",
                    "refunds": "supported",
                    "supported_capture_methods": [
                        "automatic",
                        "manual",
                        "sequential_automatic"
                    ],
                    "three_ds": "not_supported",
                    "no_three_ds": "supported",
                    "supported_card_networks": [
                        "Mastercard",
                        "Visa",
                        "AmericanExpress",
                        "JCB",
                        "Discover",
                        "Maestro",
                        "Interac",
                        "DinersClub",
                        "CartesBancaires",
                        "UnionPay"
                    ],
                    "supported_countries": null,
                    "supported_currencies": null,
                }
            ],
            "supported_webhook_flows": []
        }
    ]
}
```

## 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
