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): [trustpay] make paymentId optional field (#3101)

SamraatBansal62a7c3053c5e
diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rs
index 286eaf9cb5..9d9d998aa1 100644
--- a/crates/router/src/connector/trustpay.rs
+++ b/crates/router/src/connector/trustpay.rs
@@ -955,11 +955,15 @@ impl api::IncomingWebhook for Trustpay {
.switch()?;
let payment_info = trustpay_response.payment_information;
let reason = payment_info.status_reason_information.unwrap_or_default();
+ let connector_dispute_id = payment_info
+ .references
+ .payment_id
+ .ok_or(errors::ConnectorError::WebhookReferenceIdNotFound)?;
Ok(api::disputes::DisputePayload {
amount: payment_info.amount.amount.to_string(),
currency: payment_info.amount.currency,
dispute_stage: api_models::enums::DisputeStage::Dispute,
- connector_dispute_id: payment_info.references.payment_id,
+ connector_dispute_id,
connector_reason: reason.reason.reject_reason,
connector_reason_code: Some(reason.reason.code),
challenge_required_by: None,
diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs
index 270a702bd6..c112b64401 100644
--- a/crates/router/src/connector/trustpay/transformers.rs
+++ b/crates/router/src/connector/trustpay/transformers.rs
@@ -1700,7 +1700,7 @@ impl TryFrom<WebhookStatus> for diesel_models::enums::RefundStatus {
#[serde(rename_all = "PascalCase")]
pub struct WebhookReferences {
pub merchant_reference: String,
- pub payment_id: String,
+ pub payment_id: Option<String>,
pub payment_request_id: Option<String>,
}