From 3e810f8f04b9fe7cbab9215b9bf8e13955dc756a Mon Sep 17 00:00:00 2001 From: Mrudul Vajpayee Date: Fri, 29 Nov 2024 13:03:39 +0530 Subject: [PATCH] no3ds not support test support --- .../src/connectors/nexixpay/transformers.rs | 24 +++-- .../cypress/e2e/PaymentUtils/Nexixpay.js | 99 ++++++++++++------- 2 files changed, 81 insertions(+), 42 deletions(-) diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs index 9707ad3b371a..9c35b913db72 100644 --- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs @@ -534,15 +534,23 @@ impl TryFrom<&NexixpayRouterData<&PaymentsAuthorizeRouterData>> for NexixpayPaym match item.router_data.request.payment_method_data { PaymentMethodData::Card(ref req_card) => { - Ok(Self::NexixpayNonMandatePaymentRequest(Box::new( - NexixpayNonMandatePaymentRequest { - card: NexixpayCard { - pan: req_card.card_number.clone(), - expiry_date: req_card.get_expiry_date_as_mmyy()?, + if item.router_data.is_three_ds() { + Ok(Self::NexixpayNonMandatePaymentRequest(Box::new( + NexixpayNonMandatePaymentRequest { + card: NexixpayCard { + pan: req_card.card_number.clone(), + expiry_date: req_card.get_expiry_date_as_mmyy()?, + }, + recurrence: recurrence_request_obj, }, - recurrence: recurrence_request_obj, - }, - ))) + ))) + } else { + Err(errors::ConnectorError::NotSupported { + message: "No threeds is not supported".to_string(), + connector: "nexixpay", + } + .into()) + } } PaymentMethodData::CardRedirect(_) | PaymentMethodData::Wallet(_) diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Nexixpay.js b/cypress-tests/cypress/e2e/PaymentUtils/Nexixpay.js index 713f3723b274..ccb6388df112 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Nexixpay.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Nexixpay.js @@ -27,7 +27,7 @@ const multiUseMandateData = { }, mandate_type: { multi_use: { - amount: 3545, + amount: 8000, currency: "EUR", }, }, @@ -44,7 +44,7 @@ const singleUseMandateData = { }, mandate_type: { multi_use: { - amount: 3545, + amount: 8000, currency: "EUR", }, }, @@ -72,7 +72,7 @@ export const connectorDetails = { PaymentIntent: { Request: { currency: "EUR", - amount: 3545, + amount: 6500, customer_acceptance: null, setup_future_usage: "on_session", billing: { @@ -96,6 +96,22 @@ export const connectorDetails = { }, }, }, + PaymentIntentOffSession: { + Request: { + currency: "EUR", + amount: 6500, + authentication_type: "no_three_ds", + customer_acceptance: null, + setup_future_usage: "off_session", + }, + Response: { + status: 200, + body: { + status: "requires_payment_method", + setup_future_usage: "off_session", + }, + }, + }, "3DSManualCapture": { Request: { payment_method: "card", @@ -167,7 +183,6 @@ export const connectorDetails = { No3DSManualCapture: { Request: { payment_method: "card", - amount: 3545, payment_method_data: { card: successfulNo3DSCardDetails, }, @@ -189,9 +204,13 @@ export const connectorDetails = { }, }, Response: { - status: 200, + status: 501, body: { - status: "requires_customer_action", + error: { + type: "invalid_request", + message: "No threeds is not supported", + code: "IR_00", + }, }, }, }, @@ -219,11 +238,15 @@ export const connectorDetails = { }, }, Response: { - status: 200, + status: 501, body: { - status: "requires_customer_action", + error: { + type: "invalid_request", + message: "No threeds is not supported", + code: "IR_00", + }, }, - }, + } }, Capture: { Request: { @@ -237,9 +260,9 @@ export const connectorDetails = { status: 200, body: { status: "processing", - amount: 3545, - amount_capturable: 0, - amount_received: 3545, + amount: 6500, + amount_capturable: 6500, + amount_received: null, }, }, }, @@ -249,8 +272,8 @@ export const connectorDetails = { status: 200, body: { status: "processing", - amount: 3545, - amount_capturable: 0, + amount: 6500, + amount_capturable: 6500, amount_received: 100, }, }, @@ -312,7 +335,6 @@ export const connectorDetails = { MandateMultiUse3DSAutoCapture: { Request: { payment_method: "card", - amount: 3545, payment_method_data: { card: successfulThreeDSTestCardDetails, }, @@ -343,7 +365,6 @@ export const connectorDetails = { MandateMultiUse3DSManualCapture: { Request: { payment_method: "card", - amount: 3545, payment_method_data: { card: successfulThreeDSTestCardDetails, }, @@ -375,7 +396,6 @@ export const connectorDetails = { MandateMultiUseNo3DSAutoCapture: { Request: { payment_method: "card", - amount: 3545, payment_method_data: { card: successfulNo3DSCardDetails, }, @@ -396,16 +416,19 @@ export const connectorDetails = { }, }, Response: { - status: 200, + status: 501, body: { - status: "requires_customer_action", + error: { + type: "invalid_request", + message: "No threeds is not supported", + code: "IR_00", + }, }, - }, + } }, MandateMultiUseNo3DSManualCapture: { Request: { payment_method: "card", - amount: 3545, payment_method_data: { card: successfulNo3DSCardDetails, }, @@ -426,16 +449,19 @@ export const connectorDetails = { }, }, Response: { - status: 200, + status: 501, body: { - status: "requires_customer_action", + error: { + type: "invalid_request", + message: "No threeds is not supported", + code: "IR_00", + }, }, - }, + } }, MandateSingleUse3DSAutoCapture: { Request: { payment_method: "card", - amount: 3545, payment_method_data: { card: successfulThreeDSTestCardDetails, }, @@ -465,7 +491,6 @@ export const connectorDetails = { MandateSingleUse3DSManualCapture: { Request: { payment_method: "card", - amount: 3545, payment_method_data: { card: successfulThreeDSTestCardDetails, }, @@ -495,7 +520,6 @@ export const connectorDetails = { MandateSingleUseNo3DSAutoCapture: { Request: { payment_method: "card", - amount: 3545, payment_method_data: { card: successfulNo3DSCardDetails, }, @@ -516,16 +540,19 @@ export const connectorDetails = { }, }, Response: { - status: 200, + status: 501, body: { - status: "requires_customer_action", + error: { + type: "invalid_request", + message: "No threeds is not supported", + code: "IR_00", + }, }, - }, + } }, MandateSingleUseNo3DSManualCapture: { Request: { payment_method: "card", - amount: 3545, payment_method_data: { card: successfulNo3DSCardDetails, }, @@ -546,11 +573,15 @@ export const connectorDetails = { }, }, Response: { - status: 200, + status: 501, body: { - status: "requires_customer_action", + error: { + type: "invalid_request", + message: "No threeds is not supported", + code: "IR_00", + }, }, - }, + } }, }, };