Skip to content

Commit

Permalink
fix(connector): [trustpay] make paymentId optional field (#3101)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamraatBansal authored Dec 12, 2023
1 parent ca2c399 commit 62a7c30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion crates/router/src/connector/trustpay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/trustpay/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
}

Expand Down

0 comments on commit 62a7c30

Please sign in to comment.