Bug: Pass the shipping email whenever the billing details are included in the session token response



Currently we pass the below fields if the respective fields are enabled in the business profile

if `collect_shipping_details_from_wallet_connector = true`
```
"shipping_address_required": true,
         "email_required": true,
         "shipping_address_parameters": {
           "phone_number_required": true
         }
```

if `collect_billing_details_from_wallet_connector = true`
```
       "billing_address_required": true,
       "billing_address_parameters": {
         "phone_number_required": true,
         "format": "FULL"
       }

```

This in case we need to pass ` "email_required": true,` if either of fields are true


diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index b52cf98b287..664038454a4 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -334,6 +334,21 @@ async fn create_applepay_session_token(
             })
             .flatten();
 
+        // If collect_shipping_details_from_wallet_connector is false, we check if
+        // collect_billing_details_from_wallet_connector is true. If it is, then we pass the Email and Phone in
+        // ApplePayShippingContactFields as it is a required parameter and ApplePayBillingContactFields
+        // does not contain Email and Phone.
+        let required_shipping_contact_fields_updated = if required_billing_contact_fields.is_some()
+            && required_shipping_contact_fields.is_none()
+        {
+            Some(payment_types::ApplePayShippingContactFields(vec![
+                payment_types::ApplePayAddressParameters::Phone,
+                payment_types::ApplePayAddressParameters::Email,
+            ]))
+        } else {
+            required_shipping_contact_fields
+        };
+
         // Get apple pay payment request
         let applepay_payment_request = get_apple_pay_payment_request(
             amount_info,
@@ -342,7 +357,7 @@ async fn create_applepay_session_token(
             apple_pay_merchant_identifier.as_str(),
             merchant_business_country,
             required_billing_contact_fields,
-            required_shipping_contact_fields,
+            required_shipping_contact_fields_updated,
         )?;
 
         let apple_pay_session_response = match (
@@ -670,7 +685,11 @@ fn create_gpay_session_token(
                             delayed_session_token: false,
                             secrets: None,
                             shipping_address_required: required_shipping_contact_fields,
-                            email_required: required_shipping_contact_fields,
+                            // We pass Email as a required field irrespective of
+                            // collect_billing_details_from_wallet_connector or
+                            // collect_shipping_details_from_wallet_connector as it is common to both.
+                            email_required: required_shipping_contact_fields
+                                || is_billing_details_required,
                             shipping_address_parameters:
                                 api_models::payments::GpayShippingAddressParameters {
                                     phone_number_required: required_shipping_contact_fields,

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

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

## Description
<!-- Describe your changes in detail -->
Currently we pass the below fields if the respective fields are enabled in the business profile

if `collect_shipping_details_from_wallet_connector = true`
```
"shipping_address_required": true,
         "email_required": true,
         "shipping_address_parameters": {
           "phone_number_required": true
         }
```

if `collect_billing_details_from_wallet_connector = true`
```
       "billing_address_required": true,
       "billing_address_parameters": {
         "phone_number_required": true,
         "format": "FULL"
       }

```

This in case we need to pass ` "email_required": true,` if either of fields are true



### 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)?
-->
-> Create a mca with apple pay and google pay enabled
-> Hit the below curl for the business profile
```
curl --location 'http://localhost:8080/account/merchant_1720188909/business_profile/pro_GXFptNIQjSYqmFij5MpV' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": false
}'
```
-> Create a payment with confirm false
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_XkOoiQAOGF1WZr5hWWxw2yZeZRKLjsFeve4elfwJAIHEgQrPTeP7qr8DW2aMiMrx' \
--data '{
  "amount": 10000,
  "currency": "USD",
  "capture_method": "automatic",
  "authentication_type": "no_three_ds",
  "confirm": false,
  "customer_id": "aaa"
}'
```
-> Make a session call with the payment id and there should not be any shipping or billing fields for google pay (for gpay it will be false) or apple pay
```
curl --location 'http://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_5b909460522a43a588f9b8728f0982b9' \
--data '{
    "payment_id": "pay_L5o2s0kwCaRt8nsMcMk5",
    "wallets": [],
    "client_secret": "pay_L5o2s0kwCaRt8nsMcMk5_secret_SVQqKQWw5vYxyBhSuJHZ"
}'

```
<img width="1180" alt="image" src="https://github.com/juspay/hyperswitch/assets/83439957/4935adc0-2b05-468e-ac94-4b350daa61e5">

-> Now set the billing fields to true
```
curl --location 'http://localhost:8080/account/merchant_1720188909/business_profile/pro_GXFptNIQjSYqmFij5MpV' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": true
}'
```
-> Create a payment with confirm false
-> Make a session call. It will have `phone` for apple pay shipping and `"email_required": true,` for goole pay
<img width="1172" alt="image" src="https://github.com/juspay/hyperswitch/assets/83439957/7c9f3eb3-e50d-40ef-9ed6-890ca9a28ebc">
<img width="1202" alt="image" src="https://github.com/juspay/hyperswitch/assets/83439957/9e375da2-054c-48be-af70-2e6bda589653">

-> Now enable both the fields in the business profile
```
curl --location 'http://localhost:8080/account/merchant_1720188909/business_profile/pro_GXFptNIQjSYqmFij5MpV' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": true
}'
```
-> Make payment create and session call
<img width="1182" alt="image" src="https://github.com/juspay/hyperswitch/assets/83439957/0d8bdb69-009f-411c-b095-2e15854dfbe5">

-> Now enable only shipping
```
curl --location 'http://localhost:8080/account/merchant_1720188909/business_profile/pro_GXFptNIQjSYqmFij5MpV' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "collect_shipping_details_from_wallet_connector": true,
    "collect_billing_details_from_wallet_connector": false
}'
```
<img width="1179" alt="image" src="https://github.com/juspay/hyperswitch/assets/83439957/826bffce-18c0-4662-8aee-39aec487ccea">


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