Bug: [REFACTOR] facilitapay destination bank account number should be merchant facing



destination bank account number should be added by merchant, not customer. this is a design flaw that needs to be fixed.
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 59c609a294d..e62126f9102 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -3433,15 +3433,12 @@ pub enum BankTransferData {
         /// CNPJ is a Brazilian company tax identification number
         #[schema(value_type = Option<String>, example = "74469027417312")]
         cnpj: Option<Secret<String>>,
-
         /// Source bank account number
-        #[schema(value_type = Option<String>, example = "8b2812f0-d6c8-4073-97bb-9fa964d08bc5")]
+        #[schema(value_type = Option<String>, example = "8b******-****-****-****-*******08bc5")]
         source_bank_account_id: Option<MaskedBankAccount>,
-
-        /// Destination bank account number
-        #[schema(value_type = Option<String>, example = "9b95f84e-de61-460b-a14b-f23b4e71c97b")]
+        /// Partially masked destination bank account number _Deprecated: Will be removed in next stable release._
+        #[schema(value_type = Option<String>, example = "********-****-460b-****-f23b4e71c97b", deprecated)]
         destination_bank_account_id: Option<MaskedBankAccount>,
-
         /// The expiration date and time for the Pix QR code in ISO 8601 format
         #[schema(value_type = Option<String>, example = "2025-09-10T10:11:12Z")]
         #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
diff --git a/crates/api_models/src/payments/additional_info.rs b/crates/api_models/src/payments/additional_info.rs
index 099e055980a..96b4209ac41 100644
--- a/crates/api_models/src/payments/additional_info.rs
+++ b/crates/api_models/src/payments/additional_info.rs
@@ -174,8 +174,8 @@ pub struct PixBankTransferAdditionalData {
     #[schema(value_type = Option<String>, example = "********-****-4073-****-9fa964d08bc5")]
     pub source_bank_account_id: Option<MaskedBankAccount>,
 
-    /// Partially masked destination bank account number
-    #[schema(value_type = Option<String>, example = "********-****-460b-****-f23b4e71c97b")]
+    /// Partially masked destination bank account number _Deprecated: Will be removed in next stable release._
+    #[schema(value_type = Option<String>, example = "********-****-460b-****-f23b4e71c97b", deprecated)]
     pub destination_bank_account_id: Option<MaskedBankAccount>,
 
     /// The expiration date and time for the Pix QR code in ISO 8601 format
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 9e493eb6a54..0aa70982492 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -6071,7 +6071,12 @@ api_secret="Secret Key"
 [facilitapay.connector_auth.BodyKey]
   api_key="Password"
   key1="Username"
-
+[facilitapay.metadata.destination_account_number]
+  name="destination_account_number"
+  label="Destination Account Number"
+  placeholder="Enter Destination Account Number"
+  required=true
+  type="Text"
 
 [archipel]
 [archipel.connector_auth.HeaderKey]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index e81c3f6aac9..9a4663d3696 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -4637,6 +4637,13 @@ payment_method_type = "pix"
 api_key = "Password"
 key1 = "Username"
 
+[facilitapay.metadata.destination_account_number]
+name="destination_account_number"
+label="Destination Account Number"
+placeholder="Enter Destination Account Number"
+required=true
+type="Text"
+
 [archipel]
 [archipel.connector_auth.HeaderKey]
 api_key = "Enter CA Certificate PEM"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index bdd9cde57f0..c497c9aca29 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -6053,6 +6053,13 @@ payment_method_type = "pix"
 api_key = "Password"
 key1 = "Username"
 
+[facilitapay.metadata.destination_account_number]
+name="destination_account_number"
+label="Destination Account Number"
+placeholder="Enter Destination Account Number"
+required=true
+type="Text"
+
 [archipel]
 [archipel.connector_auth.HeaderKey]
 api_key = "Enter CA Certificate PEM"
diff --git a/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs
index 9e7d4a06a2f..9de5b7454c3 100644
--- a/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs
@@ -3,6 +3,8 @@ use common_enums::{enums, PaymentMethod};
 use common_utils::{
     errors::CustomResult,
     ext_traits::{BytesExt, Encode},
+    new_type::MaskedBankAccount,
+    pii,
     types::StringMajorUnit,
 };
 use error_stack::ResultExt;
@@ -18,6 +20,7 @@ use hyperswitch_interfaces::{
     consts, errors, events::connector_api_logs::ConnectorEvent, types::Response,
 };
 use masking::{ExposeInterface, Secret};
+use serde::{Deserialize, Serialize};
 use time::PrimitiveDateTime;
 use url::Url;
 
@@ -34,7 +37,7 @@ use super::{
 };
 use crate::{
     types::{RefreshTokenRouterData, RefundsResponseRouterData, ResponseRouterData},
-    utils::{is_payment_failure, missing_field_err, QrImage, RouterData as OtherRouterData},
+    utils::{self, is_payment_failure, missing_field_err, QrImage, RouterData as OtherRouterData},
 };
 type Error = error_stack::Report<errors::ConnectorError>;
 
@@ -47,6 +50,65 @@ impl<T> From<(StringMajorUnit, T)> for FacilitapayRouterData<T> {
     }
 }
 
+// Auth Struct
+#[derive(Debug, Clone)]
+pub struct FacilitapayAuthType {
+    pub(super) username: Secret<String>,
+    pub(super) password: Secret<String>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct FacilitapayConnectorMetadataObject {
+    // pub destination_account_number: Secret<String>,
+    pub destination_account_number: MaskedBankAccount,
+}
+
+// Helper to build the request from Hyperswitch Auth Type
+impl FacilitapayAuthRequest {
+    fn from_auth_type(auth: &FacilitapayAuthType) -> Self {
+        Self {
+            user: FacilitapayCredentials {
+                username: auth.username.clone(),
+                password: auth.password.clone(),
+            },
+        }
+    }
+}
+
+impl TryFrom<&ConnectorAuthType> for FacilitapayAuthType {
+    type Error = Error;
+    fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+        match auth_type {
+            ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
+                username: key1.to_owned(),
+                password: api_key.to_owned(),
+            }),
+            _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+        }
+    }
+}
+
+impl TryFrom<&RefreshTokenRouterData> for FacilitapayAuthRequest {
+    type Error = Error;
+    fn try_from(item: &RefreshTokenRouterData) -> Result<Self, Self::Error> {
+        let auth_type = FacilitapayAuthType::try_from(&item.connector_auth_type)?;
+        Ok(Self::from_auth_type(&auth_type))
+    }
+}
+
+impl TryFrom<&Option<pii::SecretSerdeValue>> for FacilitapayConnectorMetadataObject {
+    type Error = Error;
+
+    fn try_from(meta_data: &Option<pii::SecretSerdeValue>) -> Result<Self, Self::Error> {
+        let metadata: Self = utils::to_connector_meta_from_secret(meta_data.clone())
+            .change_context(errors::ConnectorError::InvalidConnectorConfig {
+                config: "merchant_connector_account.metadata",
+            })?;
+
+        Ok(metadata)
+    }
+}
+
 impl TryFrom<&FacilitapayRouterData<&types::PaymentsAuthorizeRouterData>>
     for FacilitapayPaymentsRequest
 {
@@ -54,11 +116,13 @@ impl TryFrom<&FacilitapayRouterData<&types::PaymentsAuthorizeRouterData>>
     fn try_from(
         item: &FacilitapayRouterData<&types::PaymentsAuthorizeRouterData>,
     ) -> Result<Self, Self::Error> {
+        let metadata =
+            FacilitapayConnectorMetadataObject::try_from(&item.router_data.connector_meta_data)?;
+
         match item.router_data.request.payment_method_data.clone() {
             PaymentMethodData::BankTransfer(bank_transfer_data) => match *bank_transfer_data {
                 BankTransferData::Pix {
                     source_bank_account_id,
-                    destination_bank_account_id,
                     ..
                 } => {
                     // Set expiry time to 15 minutes from now
@@ -80,11 +144,7 @@ impl TryFrom<&FacilitapayRouterData<&types::PaymentsAuthorizeRouterData>>
                                 },
                             )?,
 
-                            to_bank_account_id: destination_bank_account_id.clone().ok_or(
-                                errors::ConnectorError::MissingRequiredField {
-                                    field_name: "destination bank account id",
-                                },
-                            )?,
+                            to_bank_account_id: metadata.destination_account_number,
                             currency: item.router_data.request.currency,
                             exchange_currency: item.router_data.request.currency,
                             value: item.amount.clone(),
@@ -146,46 +206,6 @@ impl TryFrom<&FacilitapayRouterData<&types::PaymentsAuthorizeRouterData>>
     }
 }
 
-// Helper to build the request from Hyperswitch Auth Type
-impl FacilitapayAuthRequest {
-    fn from_auth_type(auth: &FacilitapayAuthType) -> Self {
-        Self {
-            user: FacilitapayCredentials {
-                username: auth.username.clone(),
-                password: auth.password.clone(),
-            },
-        }
-    }
-}
-
-// Auth Struct
-#[derive(Debug, Clone)]
-pub struct FacilitapayAuthType {
-    pub(super) username: Secret<String>,
-    pub(super) password: Secret<String>,
-}
-
-impl TryFrom<&ConnectorAuthType> for FacilitapayAuthType {
-    type Error = Error;
-    fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
-        match auth_type {
-            ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
-                username: key1.to_owned(),
-                password: api_key.to_owned(),
-            }),
-            _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
-        }
-    }
-}
-
-impl TryFrom<&RefreshTokenRouterData> for FacilitapayAuthRequest {
-    type Error = Error;
-    fn try_from(item: &RefreshTokenRouterData) -> Result<Self, Self::Error> {
-        let auth_type = FacilitapayAuthType::try_from(&item.connector_auth_type)?;
-        Ok(Self::from_auth_type(&auth_type))
-    }
-}
-
 fn convert_to_document_type(document_type: &str) -> Result<DocumentType, errors::ConnectorError> {
     match document_type.to_lowercase().as_str() {
         "cc" => Ok(DocumentType::CedulaDeCiudadania),
@@ -394,7 +414,13 @@ impl<F, T> TryFrom<ResponseRouterData<F, FacilitapayPaymentsResponse, T, Payment
         let status = if item.data.payment_method == PaymentMethod::BankTransfer
             && item.response.data.status == FacilitapayPaymentStatus::Identified
         {
-            common_enums::AttemptStatus::AuthenticationPending
+            if item.response.data.currency != item.response.data.exchange_currency {
+                // Cross-currency: Identified is not terminal
+                common_enums::AttemptStatus::Pending
+            } else {
+                // Local currency: Identified is terminal
+                common_enums::AttemptStatus::Charged
+            }
         } else {
             common_enums::AttemptStatus::from(item.response.data.status.clone())
         };
diff --git a/crates/payment_methods/src/configs/payment_connector_required_fields.rs b/crates/payment_methods/src/configs/payment_connector_required_fields.rs
index 2dd291d16f5..a57d3002caf 100644
--- a/crates/payment_methods/src/configs/payment_connector_required_fields.rs
+++ b/crates/payment_methods/src/configs/payment_connector_required_fields.rs
@@ -193,7 +193,6 @@ enum RequiredField {
     PixCnpj,
     PixCpf,
     PixSourceBankAccountId,
-    PixDestinationBankAccountId,
     GiftCardNumber,
     GiftCardCvc,
     DcbMsisdn,
@@ -808,17 +807,6 @@ impl RequiredField {
                     value: None,
                 },
             ),
-            Self::PixDestinationBankAccountId => (
-                "payment_method_data.bank_transfer.pix.destination_bank_account_id".to_string(),
-                RequiredFieldInfo {
-                    required_field:
-                        "payment_method_data.bank_transfer.pix.destination_bank_account_id"
-                            .to_string(),
-                    display_name: "destination_bank_account_id".to_string(),
-                    field_type: FieldType::UserDestinationBankAccountId,
-                    value: None,
-                },
-            ),
             Self::GiftCardNumber => (
                 "payment_method_data.gift_card.number".to_string(),
                 RequiredFieldInfo {
@@ -3232,7 +3220,6 @@ fn get_bank_transfer_required_fields() -> HashMap<enums::PaymentMethodType, Conn
                         non_mandate: HashMap::new(),
                         common: HashMap::from([
                             RequiredField::PixSourceBankAccountId.to_tuple(),
-                            RequiredField::PixDestinationBankAccountId.to_tuple(),
                             RequiredField::BillingAddressCountries(vec!["BR"]).to_tuple(),
                             RequiredField::BillingUserFirstName.to_tuple(),
                             RequiredField::BillingUserLastName.to_tuple(),
diff --git a/crates/router/src/core/connector_validation.rs b/crates/router/src/core/connector_validation.rs
index f04edb139f2..8f0bce516cb 100644
--- a/crates/router/src/core/connector_validation.rs
+++ b/crates/router/src/core/connector_validation.rs
@@ -210,6 +210,9 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
             }
             api_enums::Connector::Facilitapay => {
                 facilitapay::transformers::FacilitapayAuthType::try_from(self.auth_type)?;
+                facilitapay::transformers::FacilitapayConnectorMetadataObject::try_from(
+                    self.connector_meta_data,
+                )?;
                 Ok(())
             }
             api_enums::Connector::Fiserv => {

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

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

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

Destination bank account id should be merchant facing, not customer. This PR removes any references to destination bank account id and moves it to connector metadata instead.

### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [x] 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`
-->

/crates/connector_configs/toml/development.toml
/crates/connector_configs/toml/sandbox.toml
/crates/connector_configs/toml/production.toml

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

Customer should not enter merchant's bank details. It should be merchant facing instead.
Closes #8703.

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

Create MCA:

```curl
curl --location 'http://localhost:8080/account/postman_merchant_GHAction_1753083253/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Dyq5nDoX7lVK7WTywFMzt7RKqlI86c6FFg7kun0keGiZpByVLgo8y4dhdbAqYIm8' \
--data-raw '{
    "connector_type": "payment_processor",
    "connector_name": "facilitapay",
    "business_country": "US",
    "business_label": "default",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": "api_key",
        "key1": "key1"
    },
    "test_mode": false,
    "disabled": false,
	"metadata": {
        "destination_account_number": "<UUID>"
	},
    "payment_methods_enabled": [
        {
            "payment_method": "bank_transfer",
            "payment_method_types": [
                {
                    "payment_method_type": "pix",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
    ]
}'
```
```json
{
    "connector_type": "payment_processor",
    "connector_name": "facilitapay",
    "connector_label": "facilitapay_US_default",
    "merchant_connector_id": "mca_rMIEEmHi0UapY2hNpT3H",
    "profile_id": "pro_0ebkZdbr9FTvQ7UwInzm",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": "api_key",
        "key1": "key1"
    },
    "payment_methods_enabled": [
        {
            "payment_method": "bank_transfer",
            "payment_method_types": [
                {
                    "payment_method_type": "pix",
                    "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": {
        "destination_account_number": "UUID"
    },
    "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
}
```

Not passing connector metadata during MCA create call should result in a 4xx like below:

```json
{
    "error": {
        "type": "invalid_request",
        "message": "The merchant_connector_account.metadata is invalid",
        "code": "IR_06"
    }
}
```

<img width="729" height="981" alt="image" src="https://github.com/user-attachments/assets/42100bec-8635-41d5-a71c-d861de229385" />

<img width="642" height="1038" alt="image" src="https://github.com/user-attachments/assets/d0a146e4-f021-49a7-97b5-4b49556bf638" />

I'll fix the 1 failure in next PR. We throw `501`, commons expects a `2xx`

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

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