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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! Out-of-band transitions: what a payment provider did that DeloPay never
//! observed, recorded by an operator.
use serde::Deserialize;
use serde_json::Value;
/// A recorded out-of-band transition.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct ExternalRecordResponse {
/// The record's id.
pub record_id: String,
/// `payment`, `refund`, `dispute` or `payout`.
pub resource_kind: String,
/// The object the transition was written to.
pub resource_id: String,
/// The payment the object belongs to.
#[serde(default)]
pub payment_id: Option<String>,
/// Whether the record created the object.
pub created_resource: bool,
/// The object's status before.
#[serde(default)]
pub previous_status: Option<String>,
/// The status recorded.
pub recorded_status: String,
/// What became of the outgoing webhook.
#[serde(default)]
pub webhook_outcome: Option<String>,
/// Who recorded it.
pub recorded_by: String,
/// When, ISO 8601.
pub recorded_at: String,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// Whether an object with no record yet can be created by a record.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct ExternalRecordCreateSupport {
/// `served`; `not_implemented` (a gap in this release) or
/// `not_applicable` (refused by a rule).
pub status: String,
/// Why it is not served: the message a create call answers with.
#[serde(default)]
pub reason: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// What this deployment accepts for one kind of object.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct ExternalRecordKindCapability {
/// `payment`, `refund`, `dispute` or `payout`.
pub resource: String,
/// Whether a transition of an object DeloPay already holds is served.
pub transition: bool,
/// Whether an object DeloPay does not hold yet can be created.
pub create: ExternalRecordCreateSupport,
/// Every status spelling the kind accepts.
#[serde(default)]
pub statuses: Vec<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// What this deployment accepts, per kind of object.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct ExternalRecordCapabilities {
/// Every kind, served or not.
#[serde(default)]
pub kinds: Vec<ExternalRecordKindCapability>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}