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): Nuvie psync + rsync delay exception (#10284)

Nithin Nfa6de79fe5fd
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index db275e8773..f9ad90de91 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -3438,6 +3438,11 @@ where
let (amount_captured, minor_amount_capturable) =
get_amount_captured(response.get_partial_approval(), transaction_type.clone())?;
+
+ if bypass_error_for_no_payments_found(response.err_code) {
+ return Ok(item.data);
+ };
+
Ok(Self {
status,
response: if let Some(err) = build_error_response(ErrorResponseParams {
@@ -3556,6 +3561,9 @@ impl TryFrom<RefundsResponseRouterData<RSync, NuveiTransactionSyncResponse>>
fn try_from(
item: RefundsResponseRouterData<RSync, NuveiTransactionSyncResponse>,
) -> Result<Self, Self::Error> {
+ if bypass_error_for_no_payments_found(item.response.err_code) {
+ return Ok(item.data);
+ };
let txn_id = item
.response
.transaction_details
@@ -4447,3 +4455,12 @@ impl From<DisputeUnifiedStatusCode> for common_enums::DisputeStage {
}
}
}
+/// bypass error state when psync is called immediately and psp returns no payments found
+/// https://docs.nuvei.com/documentation/integration/response-handling/
+fn bypass_error_for_no_payments_found(err_code: Option<i64>) -> bool {
+ match err_code {
+ //No transaction details returned for the provided ID.
+ Some(9146) => true,
+ _ => false,
+ }
+}