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(connectors): [Nexixpay] fix for failing MITs (#9614)

Mrudul Vajpayeec2a35606794f
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
index 2cf30de8ed..e1a5f783ff 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
@@ -39,7 +39,7 @@ use crate::{
get_unimplemented_payment_method_error_message, to_connector_meta,
to_connector_meta_from_secret, CardData, PaymentsAuthorizeRequestData,
PaymentsCompleteAuthorizeRequestData, PaymentsPreProcessingRequestData,
- PaymentsSetupMandateRequestData, RouterData as _,
+ PaymentsSetupMandateRequestData, PaymentsSyncRequestData, RouterData as _,
},
};
@@ -1081,6 +1081,19 @@ impl<F>
},
psync_flow: NexixpayPaymentIntent::Authorize
}));
+ let mandate_reference = if item.data.request.is_mandate_payment() {
+ Box::new(Some(MandateReference {
+ connector_mandate_id: item
+ .data
+ .connector_mandate_request_reference_id
+ .clone(),
+ payment_method_id: None,
+ mandate_metadata: None,
+ connector_mandate_request_reference_id: None,
+ }))
+ } else {
+ Box::new(None)
+ };
let status = AttemptStatus::from(response_body.operation.operation_result.clone());
match status {
AttemptStatus::Failure => {
@@ -1100,15 +1113,7 @@ impl<F>
response_body.operation.order_id.clone(),
),
redirection_data: Box::new(Some(redirection_form.clone())),
- mandate_reference: Box::new(Some(MandateReference {
- connector_mandate_id: item
- .data
- .connector_mandate_request_reference_id
- .clone(),
- payment_method_id: None,
- mandate_metadata: None,
- connector_mandate_request_reference_id: None,
- })),
+ mandate_reference,
connector_metadata,
network_txn_id: None,
connector_response_reference_id: Some(
@@ -1257,6 +1262,16 @@ impl<F>
meta_data,
is_auto_capture,
})?);
+ let mandate_reference = if item.data.request.is_mandate_payment() {
+ Box::new(Some(MandateReference {
+ connector_mandate_id: item.data.connector_mandate_request_reference_id.clone(),
+ payment_method_id: None,
+ mandate_metadata: None,
+ connector_mandate_request_reference_id: None,
+ }))
+ } else {
+ Box::new(None)
+ };
let status = if item.data.request.amount == 0
&& item.response.operation.operation_result == NexixpayPaymentStatus::Authorized
{
@@ -1282,15 +1297,7 @@ impl<F>
item.response.operation.order_id.clone(),
),
redirection_data: Box::new(None),
- mandate_reference: Box::new(Some(MandateReference {
- connector_mandate_id: item
- .data
- .connector_mandate_request_reference_id
- .clone(),
- payment_method_id: None,
- mandate_metadata: None,
- connector_mandate_request_reference_id: None,
- })),
+ mandate_reference,
connector_metadata,
network_txn_id: None,
connector_response_reference_id: Some(item.response.operation.order_id),
@@ -1466,6 +1473,16 @@ impl<F>
>,
) -> Result<Self, Self::Error> {
let status = AttemptStatus::from(item.response.operation_result.clone());
+ let mandate_reference = if item.data.request.is_mandate_payment() {
+ Box::new(Some(MandateReference {
+ connector_mandate_id: item.data.connector_mandate_request_reference_id.clone(),
+ payment_method_id: None,
+ mandate_metadata: None,
+ connector_mandate_request_reference_id: None,
+ }))
+ } else {
+ Box::new(None)
+ };
match status {
AttemptStatus::Failure => {
let response = Err(get_error_response(
@@ -1482,15 +1499,7 @@ impl<F>
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(item.response.order_id.clone()),
redirection_data: Box::new(None),
- mandate_reference: Box::new(Some(MandateReference {
- connector_mandate_id: item
- .data
- .connector_mandate_request_reference_id
- .clone(),
- payment_method_id: None,
- mandate_metadata: None,
- connector_mandate_request_reference_id: None,
- })),
+ mandate_reference,
connector_metadata: item.data.request.connector_meta.clone(),
network_txn_id: None,
connector_response_reference_id: Some(item.response.order_id.clone()),