Bug: Fix(bug): Backend Issue for 4-Digit Input and Correct 3DS Routing Through no_3ds for Datatrans



https://github.com/juspay/hyperswitch-cloud/issues/6000


1)Expiry Month : YYYY gives error
2)3ds should get routed through no_3ds, and should not throw an error


diff --git a/crates/router/src/connector/datatrans/transformers.rs b/crates/router/src/connector/datatrans/transformers.rs
index 9c4ab6cf6a6..96c7bcd8b2c 100644
--- a/crates/router/src/connector/datatrans/transformers.rs
+++ b/crates/router/src/connector/datatrans/transformers.rs
@@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
 use crate::{
     connector::{
         utils as connector_utils,
-        utils::{PaymentsAuthorizeRequestData, RouterData},
+        utils::{CardData, PaymentsAuthorizeRequestData},
     },
     core::errors,
     types::{
@@ -158,21 +158,15 @@ impl TryFrom<&DatatransRouterData<&types::PaymentsAuthorizeRouterData>>
     fn try_from(
         item: &DatatransRouterData<&types::PaymentsAuthorizeRouterData>,
     ) -> Result<Self, Self::Error> {
-        if item.router_data.is_three_ds() {
-            return Err(errors::ConnectorError::NotImplemented(
-                "Three_ds payments through Datatrans".to_string(),
-            )
-            .into());
-        };
         match item.router_data.request.payment_method_data.clone() {
             domain::PaymentMethodData::Card(req_card) => Ok(Self {
                 amount: item.amount,
                 currency: item.router_data.request.currency,
                 card: PlainCardDetails {
                     res_type: "PLAIN".to_string(),
-                    number: req_card.card_number,
-                    expiry_month: req_card.card_exp_month,
-                    expiry_year: req_card.card_exp_year,
+                    number: req_card.card_number.clone(),
+                    expiry_month: req_card.card_exp_month.clone(),
+                    expiry_year: req_card.get_card_expiry_year_2_digit()?,
                 },
                 refno: item.router_data.connector_request_reference_id.clone(),
                 auto_settle: matches!(

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

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

## Description
<!-- Describe your changes in detail -->
1)Datatrans accepts expiry year in YY format only . Fixed that.
2) Removed the Check for 3ds flow (Earlier Not Implemented error was thrown)

### 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
https://github.com/juspay/hyperswitch-cloud/issues/6000#issuecomment-2238555051


## How did you test it?
**for 3DS**
Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:' \
--data '{
  "amount": 800,
  "currency": "USD",
  "amount_to_capture":800,
  "confirm": true,
  "capture_method": "automatic",
   "authentication_type": "three_ds",
  "payment_method": "card",
  "payment_method_type": "credit",
  "payment_method_data": {
    "card": {
      "card_number": "4444090101010103",
      "card_exp_month": "06",
      "card_exp_year": "2025",
      "card_holder_name": "joseph Doe",
      "card_cvc":"232"
    }
  }
}'
```
Response
```
{
    "payment_id": "pay_pftZ6ZUSVQHhl5x1LVqY",
    "merchant_id": "merchant_1721718695",
    "status": "succeeded",
    "amount": 800,
    "net_amount": 800,
    "amount_capturable": 0,
    "amount_received": 800,
    "connector": "datatrans",
    "client_secret": "",
    "created": "2024-07-23T12:45:27.244Z",
    "currency": "USD",
    "customer_id": null,
    "customer": null,
    "description": null,
    "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": "0103",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "444409",
            "card_extended_bin": null,
            "card_exp_month": "06",
            "card_exp_year": "2025",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "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": "240723144528071750",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_6MuPGJ3Nd98kACtcKri3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_6Z91ANL4judTAaUtsanU",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-23T13:00:27.244Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-07-23T12:45:28.213Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
**For YYYY (expiry year in YYYY format)**

Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_o8aYC1pZ22TWzVF1GpZx2DbTVEnuJThYNJIiLV7ui4voaLh7hsmVsvaZfzBz60RB' \
--data '{
  "amount": 1000,
  "currency": "USD",
  "amount_to_capture":1000,
  "confirm": true,
  "capture_method": "automatic",
  "payment_method": "card",
  "payment_method_type": "credit",
  "payment_method_data": {
    "card": {
      "card_number": "4000000000001000",
      "card_exp_month": "06",
      "card_exp_year": "2045",
      "card_holder_name": "joseph Doe",
      "card_cvc":"232"
    }
  }
}'
```
Response
```
{
    "payment_id": "pay_PZlQaLUHloYO8lFr3TYm",
    "merchant_id": "merchant_1721718695",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "datatrans",
    "client_secret": "pay_PZlQaLUHloYO8lFr3TYm_secret_zwBnsh3ejOBVlJDo6y3w",
    "created": "2024-07-23T12:51:23.901Z",
    "currency": "USD",
    "customer_id": null,
    "customer": null,
    "description": null,
    "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": "1000",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "06",
            "card_exp_year": "2045",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "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": "240723145124645224",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_6MuPGJ3Nd98kACtcKri3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_6Z91ANL4judTAaUtsanU",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-23T13:06:23.901Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-07-23T12:51:24.760Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```

**YY -Expiry Year**
Request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:' \
--data '{
  "amount": 1000,
  "currency": "USD",
  "amount_to_capture":1000,
  "confirm": true,
  "capture_method": "automatic",
  "payment_method": "card",
  "payment_method_type": "credit",
  "payment_method_data": {
    "card": {
      "card_number": "4000000000001000",
      "card_exp_month": "06",
      "card_exp_year": "45",
      "card_holder_name": "joseph Doe",
      "card_cvc":"232"
    }
  }
}'
```
Response
```
{
    "payment_id": "pay_cNh1ZMQY66KYko3NW1Wf",
    "merchant_id": "merchant_1721718695",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "datatrans",
    "client_secret": "pay_cNh1ZMQY66KYko3NW1Wf_secret_8iRn3JhcSLw6DoMX0fOu",
    "created": "2024-07-23T14:13:23.596Z",
    "currency": "USD",
    "customer_id": null,
    "customer": null,
    "description": null,
    "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": "1000",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "06",
            "card_exp_year": "45",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "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": "240723161326887353",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_6MuPGJ3Nd98kACtcKri3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_6Z91ANL4judTAaUtsanU",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-23T14:28:23.596Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-07-23T14:13:26.821Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
## 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
