status.rs (2582B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2022, 2026 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU Affero General Public License as published by the Free Software 7 Foundation; either version 3, or (at your option) any later version. 8 9 TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. 12 13 You should have received a copy of the GNU Affero General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 //! Transactions status in database 17 18 use taler_common::api::wire::TransferState; 19 20 /// Debit transaction status 21 /// -> Requested API request 22 /// Requested -> Ignored Invalid address 23 /// Requested -> Sent Announced to the bitcoin network 24 /// Sent -> Confirmed Mined in an N old block 25 /// Confirmed -> Requested Conflicting transaction (reorg) 26 #[derive(Debug, Clone, Copy, PartialEq, Eq, sqlx::Type)] 27 #[allow(non_camel_case_types)] 28 #[sqlx(type_name = "debit_status")] 29 pub enum DebitStatus { 30 /// Debit have been requested (default) 31 requested, 32 /// Debit will never be sent (e.g: address does not work for this network) 33 ignored, 34 /// Debit have been announced to the bitcoin network 35 sent, 36 /// Debit have been mined in an N old block 37 confirmed, 38 } 39 40 impl Into<TransferState> for DebitStatus { 41 fn into(self) -> TransferState { 42 match self { 43 DebitStatus::requested | DebitStatus::sent => TransferState::pending, 44 DebitStatus::confirmed => TransferState::success, 45 DebitStatus::ignored => TransferState::permanent_failure, 46 } 47 } 48 } 49 50 /// Bounce transaction status 51 /// -> Requested Credit in wrong format 52 /// Requested -> Ignored Insufficient found 53 /// Requested -> Sent Announced to the bitcoin network 54 /// Sent -> Confirmed Mined in an N old block 55 /// Confirmed -> Requested Conflicting transaction (reorg) 56 #[derive(Debug, Clone, Copy, PartialEq, Eq, sqlx::Type)] 57 #[allow(non_camel_case_types)] 58 #[sqlx(type_name = "debit_status")] 59 pub enum BounceStatus { 60 /// Bounce have been requested (default) 61 requested, 62 /// Bounce will never be sent (e.g: bounce amount smaller than bounce fee) 63 ignored, 64 /// Bounce have been announced to the bitcoin network 65 sent, 66 /// Bounce have been mined in an N old block 67 confirmed, 68 }