Add expired status to cash-out txs

This commit is contained in:
Rafael Taranto 2019-07-23 10:05:12 +01:00 committed by Josh Harvey
parent 919848aecd
commit 9ca3e88495
7 changed files with 75 additions and 37 deletions

View file

@ -50,6 +50,7 @@ type alias CashOutTxRec =
, error : Maybe String
, created : Date
, confirmed : Bool
, expired : Bool
}

View file

@ -104,3 +104,4 @@ cashOutTxDecoder =
|> required "error" (nullable string)
|> required "created" date
|> required "confirmedAt" confirmedDecoder
|> required "expired" bool

View file

@ -6,6 +6,7 @@ import RemoteData exposing (..)
import Common.TransactionTypes exposing (..)
import Transaction.Types exposing (..)
import Numeral exposing (format)
import Maybe.Extra exposing (isJust)
-- import Css.Admin exposing (..)
@ -53,6 +54,15 @@ cashInTxView tx =
cashOutTxView : CashOutTxRec -> Html Msg
cashOutTxView tx =
let
cancelStatus =
if isJust tx.error then
"Error"
else if tx.dispense then
"Success"
else if tx.expired then
"Expired"
else
"Pending"
error =
case tx.error of
Nothing ->
@ -66,6 +76,7 @@ cashOutTxView tx =
, div [] [ text "This is a cash-out transaction" ]
, div [] [ text ("Fiat: " ++ (format "0,0.00" tx.fiat)) ]
, div [] [ text ("Raw ticker price: " ++ (format "0,0.00" (Maybe.withDefault 0.0 tx.rawTickerPrice))) ]
, div [] [ text ("Status: " ++ cancelStatus) ]
, div [] [ text error ]
]

View file

@ -146,6 +146,8 @@ rowView tx =
"Error"
else if cashOut.dispense then
"Success"
else if cashOut.expired then
"Expired"
else
"Pending"
in