Bug: feat(router): Include `payment_experience` in PML for payments response (v2)



Required by SDK
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index e3b41ce3899..6e1c321d250 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -21692,6 +21692,14 @@
               "payment_method_subtype": {
                 "$ref": "#/components/schemas/PaymentMethodType"
               },
+              "payment_experience": {
+                "allOf": [
+                  {
+                    "$ref": "#/components/schemas/PaymentExperience"
+                  }
+                ],
+                "nullable": true
+              },
               "required_fields": {
                 "allOf": [
                   {
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 7ab8bc19361..adbfb56c0fa 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -7605,6 +7605,10 @@ pub struct ResponsePaymentMethodTypesForPayments {
     #[schema(example = "klarna", value_type = PaymentMethodType)]
     pub payment_method_subtype: common_enums::PaymentMethodType,
 
+    /// The payment experience for the payment method
+    #[schema(value_type = Option<PaymentExperience>)]
+    pub payment_experience: Option<common_enums::PaymentExperience>,
+
     /// payment method subtype specific information
     #[serde(flatten)]
     #[schema(value_type = Option<PaymentMethodSubtypeSpecificData>)]
diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs
index 887bd078914..208333ba0b2 100644
--- a/crates/router/src/core/payments/payment_methods.rs
+++ b/crates/router/src/core/payments/payment_methods.rs
@@ -87,6 +87,9 @@ impl FilteredPaymentMethodsEnabled {
                     payment_method_subtype: payment_methods_enabled
                         .payment_methods_enabled
                         .payment_method_subtype,
+                    payment_experience: payment_methods_enabled
+                        .payment_methods_enabled
+                        .payment_experience,
                 },
             )
             .collect();
@@ -100,6 +103,7 @@ struct RequiredFieldsForEnabledPaymentMethod {
     required_field: Option<Vec<api_models::payment_methods::RequiredFieldInfo>>,
     payment_method_subtype: common_enums::PaymentMethodType,
     payment_method_type: common_enums::PaymentMethod,
+    payment_experience: Option<common_enums::PaymentExperience>,
 }
 
 /// Container to hold the filtered payment methods enabled with required fields
@@ -110,6 +114,7 @@ struct RequiredFieldsAndSurchargeForEnabledPaymentMethodType {
     required_field: Option<Vec<api_models::payment_methods::RequiredFieldInfo>>,
     payment_method_subtype: common_enums::PaymentMethodType,
     payment_method_type: common_enums::PaymentMethod,
+    payment_experience: Option<common_enums::PaymentExperience>,
     surcharge: Option<api_models::payment_methods::SurchargeDetailsResponse>,
 }
 
@@ -127,6 +132,7 @@ impl RequiredFieldsAndSurchargeForEnabledPaymentMethodTypes {
                 api_models::payments::ResponsePaymentMethodTypesForPayments {
                     payment_method_type: payment_methods_enabled.payment_method_type,
                     payment_method_subtype: payment_methods_enabled.payment_method_subtype,
+                    payment_experience: payment_methods_enabled.payment_experience,
                     required_fields: payment_methods_enabled.required_field,
                     surcharge_details: payment_methods_enabled.surcharge,
                     extra_information: None,
@@ -153,6 +159,7 @@ impl RequiredFieldsForEnabledPaymentMethodTypes {
                     payment_method_type: payment_methods_enabled.payment_method_type,
                     required_field: payment_methods_enabled.required_field,
                     payment_method_subtype: payment_methods_enabled.payment_method_subtype,
+                    payment_experience: payment_methods_enabled.payment_experience,
                     surcharge: None,
                 },
             )

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

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

## Description
<!-- Describe your changes in detail -->
Added `payment_experience` in Payment Method List for Payments Response

### Additional Changes

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

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

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


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

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


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

Request:

```
curl --location 'http://localhost:8080/v2/payments/12345_pay_019740919d6a72c2b6984f9b99be203f/payment-methods' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_GKx8bxieFB51Nk5FMCi6' \
--header 'Authorization: publishable-key=pk_dev_e2eec08c40444d8e862c444d3df67cd2,client-secret=cs_019740919d817810ad313fce9534793e' \
--header 'api-key: pk_dev_e2eec08c40444d8e862c444d3df67cd2'
```

Response:
```json
{
    "payment_methods_enabled": [
        {
            "payment_method_type": "card_redirect",
            "payment_method_subtype": "card_redirect",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "card",
            "payment_method_subtype": "card",
            "payment_experience": null,
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "wallet",
            "payment_method_subtype": "google_pay",
            "payment_experience": null,
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "wallet",
            "payment_method_subtype": "apple_pay",
            "payment_experience": null,
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "wallet",
            "payment_method_subtype": "we_chat_pay",
            "payment_experience": null,
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "wallet",
            "payment_method_subtype": "ali_pay",
            "payment_experience": null,
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "wallet",
            "payment_method_subtype": "paypal",
            "payment_experience": null,
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "wallet",
            "payment_method_subtype": "mb_way",
            "payment_experience": null,
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "pay_later",
            "payment_method_subtype": "klarna",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "pay_later",
            "payment_method_subtype": "affirm",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "pay_later",
            "payment_method_subtype": "afterpay_clearpay",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "pay_later",
            "payment_method_subtype": "walley",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_redirect",
            "payment_method_subtype": "giropay",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_redirect",
            "payment_method_subtype": "ideal",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_redirect",
            "payment_method_subtype": "eps",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_redirect",
            "payment_method_subtype": "bancontact_card",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_redirect",
            "payment_method_subtype": "przelewy24",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_redirect",
            "payment_method_subtype": "sofort",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_redirect",
            "payment_method_subtype": "blik",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_redirect",
            "payment_method_subtype": "trustly",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_redirect",
            "payment_method_subtype": "online_banking_finland",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_redirect",
            "payment_method_subtype": "online_banking_poland",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_transfer",
            "payment_method_subtype": "ach",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_transfer",
            "payment_method_subtype": "sepa",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_transfer",
            "payment_method_subtype": "bacs",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_debit",
            "payment_method_subtype": "ach",
            "payment_experience": null,
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_debit",
            "payment_method_subtype": "sepa",
            "payment_experience": null,
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_debit",
            "payment_method_subtype": "bacs",
            "payment_experience": null,
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "bank_debit",
            "payment_method_subtype": "becs",
            "payment_experience": null,
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "pay_later",
            "payment_method_subtype": "klarna",
            "payment_experience": "invoke_sdk_client",
            "required_fields": null,
            "surcharge_details": null
        },
        {
            "payment_method_type": "pay_later",
            "payment_method_subtype": "klarna",
            "payment_experience": "redirect_to_url",
            "required_fields": null,
            "surcharge_details": null
        }
    ],
    "customer_payment_methods": 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`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
