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): [Worldpayxml] use request reference fallback for sync (#15366)

nithin-juspay12e983349093
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs b/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
index c45dbbb471..daea151aa2 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
@@ -228,7 +228,17 @@ impl ConnectorCommon for Worldpayxml {
}
}
-impl ConnectorValidation for Worldpayxml {}
+impl ConnectorValidation for Worldpayxml {
+ fn validate_psync_reference_id(
+ &self,
+ _data: &PaymentsSyncData,
+ _is_three_ds: bool,
+ _status: common_enums::AttemptStatus,
+ _connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ Ok(())
+ }
+}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Worldpayxml {
//TODO: implement sessions flow
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs
index eb0d39a532..3d70e97ecb 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs
@@ -2679,11 +2679,12 @@ impl TryFrom<&PaymentsSyncRouterData> for PaymentService {
let auth = WorldpayxmlAuthType::try_from(&item.connector_auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ // Order inquiries can use the original order code when no transaction ID is stored.
let order_code = item
.request
.connector_transaction_id
.get_connector_transaction_id()
- .change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
+ .unwrap_or_else(|_| item.connector_request_reference_id.clone());
let inquiry = Some(Inquiry {
order_inquiry: OrderInquiry { order_code },
@@ -4157,11 +4158,12 @@ impl TryFrom<PayoutsResponseRouterData<PoFulfill, PayoutResponse>>
impl TryFrom<&PayoutsRouterData<PoSync>> for PaymentService {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &PayoutsRouterData<PoSync>) -> Result<Self, Self::Error> {
- let order_code = item.request.connector_payout_id.to_owned().ok_or(
- errors::ConnectorError::MissingRequiredField {
- field_name: "order_code".into(),
- },
- )?;
+ // Order inquiries can use the original order code when no payout ID is stored.
+ let order_code = item
+ .request
+ .connector_payout_id
+ .clone()
+ .unwrap_or_else(|| item.connector_request_reference_id.clone());
let auth = WorldpayxmlAuthType::try_from(&item.connector_auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;