Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(connector): Fix Fiserv Deserialization Error (#10124)

Anurag5ae62a2dd963
diff --git a/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
index 290d20be7b..d7ed629928 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
@@ -939,6 +939,7 @@ pub enum FiservOrderStatus {
}
#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
pub enum FiservPaymentsResponse {
Charges(FiservChargesResponse),
Checkout(FiservCheckoutResponse),
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Fiserv.js b/cypress-tests/cypress/e2e/configs/Payment/Fiserv.js
index 7c2ea2284b..75962779ca 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Fiserv.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Fiserv.js
@@ -116,24 +116,6 @@ const requiredFields = {
],
};
-const payment_method_data_3ds = {
- card: {
- last4: "1111",
- card_type: "CREDIT",
- card_network: "Visa",
- card_issuer: "JP Morgan",
- card_issuing_country: "INDIA",
- card_isin: "411111",
- card_extended_bin: null,
- card_exp_month: "12",
- card_exp_year: "30",
- card_holder_name: "Joseph Doe",
- payment_checks: null,
- authentication_data: null,
- },
- billing: null,
-};
-
const payment_method_data_no3ds = {
card: {
last4: "1111",
@@ -221,11 +203,14 @@ export const connectorDetails = {
setup_future_usage: "on_session",
},
Response: {
- status: 200,
+ status: 400,
body: {
- status: "requires_capture",
- setup_future_usage: "on_session",
- payment_method_data: payment_method_data_3ds,
+ error: {
+ code: "IR_19",
+ message: "Payment method type not supported",
+ reason: "Cards 3DS is not supported by Fiserv",
+ type: "invalid_request",
+ },
},
},
},
@@ -240,11 +225,14 @@ export const connectorDetails = {
setup_future_usage: "on_session",
},
Response: {
- status: 200,
+ status: 400,
body: {
- status: "succeeded",
- setup_future_usage: "on_session",
- payment_method_data: payment_method_data_3ds,
+ error: {
+ code: "IR_19",
+ message: "Payment method type not supported",
+ reason: "Cards 3DS is not supported by Fiserv",
+ type: "invalid_request",
+ },
},
},
},
@@ -332,7 +320,7 @@ export const connectorDetails = {
body: {
status: "failed",
error_code: "104",
- error_message: "Unable to assign card to brand: Invalid",
+ error_message: "first 6 digits of the account number - 401288",
unified_code: "UE_9000",
unified_message: "Something went wrong",
},
@@ -621,9 +609,14 @@ export const connectorDetails = {
customer_acceptance: customerAcceptance,
},
Response: {
- status: 200,
+ status: 400,
body: {
- status: "succeeded",
+ error: {
+ code: "IR_19",
+ message: "Payment method type not supported",
+ reason: "Cards 3DS is not supported by Fiserv",
+ type: "invalid_request",
+ },
},
},
},