taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

TransactionState.kt (3586B)


      1 /*
      2  * This file is part of GNU Taler
      3  * (C) 2023 Taler Systems S.A.
      4  *
      5  * GNU Taler is free software; you can redistribute it and/or modify it under the
      6  * terms of the GNU General Public License as published by the Free Software
      7  * Foundation; either version 3, or (at your option) any later version.
      8  *
      9  * GNU 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 General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License along with
     14  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15  */
     16 
     17 package net.taler.wallet.transactions
     18 
     19 import kotlinx.serialization.SerialName
     20 import kotlinx.serialization.Serializable
     21 
     22 @Serializable
     23 data class TransactionState(
     24     val major: TransactionMajorState,
     25     val minor: TransactionMinorState? = null,
     26 ) {
     27     override fun equals(other: Any?): Boolean {
     28         return if (other is TransactionState)
     29             // if other.minor is null, then ignore minor in comparison
     30             major == other.major && (other.minor == null || minor == other.minor)
     31         else false
     32     }
     33 
     34     override fun hashCode(): Int {
     35         var result = major.hashCode()
     36         result = 31 * result + (minor?.hashCode() ?: 0)
     37         return result
     38     }
     39 }
     40 
     41 @Serializable
     42 enum class TransactionMajorState {
     43     @SerialName("unknown")
     44     Unknown,
     45 
     46     @SerialName("none")
     47     None,
     48 
     49     @SerialName("pending")
     50     Pending,
     51 
     52     @SerialName("done")
     53     Done,
     54 
     55     @SerialName("aborting")
     56     Aborting,
     57 
     58     @SerialName("aborted")
     59     Aborted,
     60 
     61     @SerialName("dialog")
     62     Dialog,
     63 
     64     @SerialName("finalizing")
     65     Finalizing,
     66 
     67     @SerialName("suspended")
     68     Suspended,
     69 
     70     @SerialName("suspended-finalizing")
     71     SuspendedFinalizing,
     72 
     73     @SerialName("suspended-aborting")
     74     SuspendedAborting,
     75 
     76     @SerialName("failed")
     77     Failed,
     78 
     79     @SerialName("expired")
     80     Expired,
     81 
     82     @SerialName("deleted")
     83     Deleted,
     84 }
     85 
     86 @Serializable
     87 enum class TransactionMinorState {
     88     @SerialName("aborting-bank")
     89     AbortingBank,
     90 
     91     @SerialName("accept-refund")
     92     AcceptRefund,
     93 
     94     @SerialName("auto-refund")
     95     AutoRefund,
     96 
     97     @SerialName("balance-kyc")
     98     BalanceKycRequired,
     99 
    100     @SerialName("bank")
    101     Bank,
    102 
    103     @SerialName("bank-confirm-transfer")
    104     BankConfirmTransfer,
    105 
    106     @SerialName("bank-register-reserve")
    107     BankRegisterReserve,
    108 
    109     @SerialName("check-refund")
    110     CheckRefund,
    111 
    112     @SerialName("claim-proposal")
    113     ClaimProposal,
    114 
    115     @SerialName("completed-by-another-wallet")
    116     CompletedByAnotherWallet,
    117 
    118     @SerialName("create-purse")
    119     CreatePurse,
    120 
    121     @SerialName("delete-purse")
    122     DeletePurse,
    123 
    124     @SerialName("deposit")
    125     Deposit,
    126 
    127     @SerialName("exchange")
    128     Exchange,
    129 
    130     @SerialName("exchange-wait-reserve")
    131     ExchangeWaitReserve,
    132 
    133     @SerialName("kyc-auth")
    134     KycAuthRequired,
    135 
    136     @SerialName("kyc-init")
    137     KycInit,
    138 
    139     @SerialName("kyc")
    140     KycRequired,
    141 
    142     @SerialName("merge")
    143     Merge,
    144 
    145     @SerialName("paid-by-other")
    146     PaidByOther,
    147 
    148     @SerialName("proposed")
    149     Proposed,
    150 
    151     @SerialName("ready")
    152     Ready,
    153 
    154     @SerialName("rebind-session")
    155     RebindSession,
    156 
    157     @SerialName("refresh")
    158     Refresh,
    159 
    160     @SerialName("refused")
    161     Refused,
    162 
    163     @SerialName("repurchase")
    164     Repurchase,
    165 
    166     @SerialName("submit-payment")
    167     SubmitPayment,
    168 
    169     @SerialName("track")
    170     Track,
    171 
    172     @SerialName("unknown")
    173     Unknown,
    174 
    175     @SerialName("withdraw")
    176     Withdraw,
    177 
    178 }