Bug: [FEATURE] Add BNPL for Nuvei payment processor



Add Buy Now Pay Later support for Nuvei
diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs
index 1653ecdc849..4fc70bba81d 100644
--- a/crates/router/src/connector/nuvei/transformers.rs
+++ b/crates/router/src/connector/nuvei/transformers.rs
@@ -177,6 +177,10 @@ pub enum AlternativePaymentMethodType {
     Ideal,
     #[serde(rename = "apmgw_EPS")]
     Eps,
+    #[serde(rename = "apmgw_Afterpay")]
+    AfterPay,
+    #[serde(rename = "apmgw_Klarna")]
+    Klarna,
 }
 
 #[serde_with::skip_serializing_none]
@@ -558,6 +562,34 @@ impl<F>
     }
 }
 
+fn get_pay_later_info<F>(
+    payment_method_type: AlternativePaymentMethodType,
+    item: &types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>,
+) -> Result<NuveiPaymentsRequest, error_stack::Report<errors::ConnectorError>> {
+    let address = item
+        .get_billing()?
+        .address
+        .as_ref()
+        .ok_or_else(utils::missing_field_err("billing.address"))?;
+    let payment_method = payment_method_type;
+    Ok(NuveiPaymentsRequest {
+        payment_option: PaymentOption {
+            alternative_payment_method: Some(AlternativePaymentMethod {
+                payment_method,
+                ..Default::default()
+            }),
+            billing_address: Some(BillingAddress {
+                email: item.request.get_email()?,
+                first_name: Some(address.get_first_name()?.to_owned()),
+                last_name: Some(address.get_last_name()?.to_owned()),
+                country: address.get_country()?.to_owned(),
+            }),
+            ..Default::default()
+        },
+        ..Default::default()
+    })
+}
+
 impl<F>
     TryFrom<(
         &types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>,
@@ -617,6 +649,21 @@ impl<F>
                 }
                 .into()),
             },
+            api::PaymentMethodData::PayLater(pay_later_data) => match pay_later_data {
+                payments::PayLaterData::KlarnaRedirect { .. } => {
+                    get_pay_later_info(AlternativePaymentMethodType::Klarna, item)
+                }
+                payments::PayLaterData::AfterpayClearpayRedirect { .. } => {
+                    get_pay_later_info(AlternativePaymentMethodType::AfterPay, item)
+                }
+                _ => Err(errors::ConnectorError::NotSupported {
+                    message: "Buy Now Pay Later".to_string(),
+                    connector: "Nuvei",
+                    payment_experience: "RedirectToUrl".to_string(),
+                }
+                .into()),
+            },
+
             _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
         }?;
         let request = Self::try_from(NuveiPaymentRequestData {

## 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 -->
add payment methods like klarna, afterpay support for Nuvei 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 its an obvious bug or documentation fix
that will have little conversation).
-->
#1067

## 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)?
-->
Since Nuvei is a closed connector, couldn't test it successfully as it needs enabling the payment method - Klarna and AfterPay.

<img width="1276" alt="Screenshot 2023-05-09 at 2 14 08 AM" src="https://user-images.githubusercontent.com/70575890/236936491-ade451cc-8816-4303-b07a-beeb9c6ca457.png">
<img width="1250" alt="Screenshot 2023-05-09 at 2 16 33 AM" src="https://user-images.githubusercontent.com/70575890/236936514-b127d9fe-2218-4beb-aa9b-52b1efbb6b00.png">
<img width="681" alt="Screenshot 2023-05-09 at 2 18 02 AM" src="https://user-images.githubusercontent.com/70575890/236936523-1ea64a89-9ce5-419a-bc7b-2a30262546ac.png">


## 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 submitted code
- [ ] I added unit tests for my changes where possible
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable
