r402_protocol/error/
problem.rs1use super::ErrorReason;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
9pub struct PaymentProblem {
10 reason: ErrorReason,
11 details: String,
12}
13
14impl PaymentProblem {
15 #[must_use]
17 pub const fn new(reason: ErrorReason, details: String) -> Self {
18 Self { reason, details }
19 }
20
21 #[must_use]
23 pub fn reason(&self) -> ErrorReason {
24 self.reason.clone()
25 }
26
27 #[must_use]
29 pub const fn reason_ref(&self) -> &ErrorReason {
30 &self.reason
31 }
32
33 #[must_use]
35 pub fn details(&self) -> &str {
36 &self.details
37 }
38}
39
40pub trait AsPaymentProblem {
42 fn as_payment_problem(&self) -> PaymentProblem;
44}