diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rs index 286eaf9cb542..9d9d998aa18c 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 270a702bd6ec..c112b6440178 100644 --- a/crates/router/src/connector/trustpay/transformers.rs +++ b/crates/router/src/connector/trustpay/transformers.rs @@ -1700,7 +1700,7 @@ impl TryFrom for diesel_models::enums::RefundStatus { #[serde(rename_all = "PascalCase")] pub struct WebhookReferences { pub merchant_reference: String, - pub payment_id: String, + pub payment_id: Option, pub payment_request_id: Option, }