1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! The dispute model.
use serde::Deserialize;
use serde_json::Value;
use crate::core::models::common::{Currency, DisputeStage, DisputeStatus};
/// Whether a processor tells DeloPay how a dispute ended.
///
/// Four states rather than a bool: `"unknown"` — we have not checked — is not
/// `"not_reported"`, and `"loss_only"` (it reports a loss and never a win) is
/// neither. Rounding that to `"reported"` would promise an outcome that never
/// comes for a dispute the merchant wins.
pub type DisputeOutcomeReporting = String;
/// A dispute as returned by the API.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct DisputeResponse {
/// Unique dispute ID.
pub dispute_id: String,
/// ID of the disputed payment.
pub payment_id: String,
/// Disputed amount (as a string, in minor units).
pub amount: String,
/// Three-letter ISO 4217 currency code.
pub currency: Currency,
/// Dispute lifecycle stage.
pub dispute_stage: DisputeStage,
/// Dispute status.
pub dispute_status: DisputeStatus,
/// Connector that reported the dispute.
#[serde(default)]
pub connector: Option<String>,
/// Connector's own dispute ID.
#[serde(default)]
pub connector_dispute_id: Option<String>,
/// Reason reported by the connector.
#[serde(default)]
pub connector_reason: Option<String>,
/// Deadline to submit a challenge, if any.
#[serde(default)]
pub challenge_required_by: Option<String>,
/// Whether this processor tells DeloPay how a dispute ended — see
/// [`DisputeOutcomeReporting`]. `None` on a router that predates the
/// field, which reads as `"unknown"`.
#[serde(default)]
pub outcome_reporting: Option<DisputeOutcomeReporting>,
/// Shop (business profile) ID.
#[serde(default)]
pub profile_id: Option<String>,
/// ISO 8601 creation timestamp.
#[serde(default)]
pub created_at: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}