From e8f41c1427fb9b30e6855c438f57b436e3372820 Mon Sep 17 00:00:00 2001 From: goga-m Date: Mon, 25 Sep 2017 16:15:17 +0300 Subject: [PATCH] Add camelize & populate in Customer --- lib/admin/admin-server.js | 6 ++--- lib/customers.js | 53 ++++++++++++++++++++++++++++++--------- public/elm.js | 32 ++++++++++++++--------- 3 files changed, 64 insertions(+), 27 deletions(-) diff --git a/lib/admin/admin-server.js b/lib/admin/admin-server.js index d558cb6d..7b910156 100644 --- a/lib/admin/admin-server.js +++ b/lib/admin/admin-server.js @@ -184,7 +184,7 @@ app.get('/api/customer/:id', (req, res, next) => { }) /** - * Endpoint for patching customer's authorized_override status + * Endpoint for patching customer's authorizedOverride status * * Possible values: blocked, verified, automatic * @@ -194,10 +194,10 @@ app.get('/api/customer/:id', (req, res, next) => { * @param {function} next Callback */ app.patch('/api/customer/:id', (req, res, next) => { - if (!req.query.authorized_override) return res.status(400).send({Error: 'Requires authorized'}) + if (!req.query.authorizedOverride) return res.status(400).send({Error: 'Requires authorized'}) return customers.patch(req.params.id, { - authorized_override: req.query.authorized_override + authorized_override: req.query.authorizedOverride }) .then(r => res.send(r)) .catch(() => res.status(404).send({Error: 'Not found'})) diff --git a/lib/customers.js b/lib/customers.js index cfa69373..a084ca0a 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -4,6 +4,7 @@ const _ = require('lodash/fp') const BN = require('./bn') const anonymous = require('../lib/constants').anonymousCustomer const NUM_RESULTS = 20 +const camelize = require('camelize') function add (customer) { const sql = 'insert into customers (id, phone, phone_at) values ($1, $2, now()) returning *' @@ -37,6 +38,9 @@ function patch (id, values) { function getById (id) { const sql = 'select * from customers where id=$1' return db.oneOrNone(sql, [id]) + .then(customer => { + return (customer) ? format(customer) : null + }) } function getDailyVolume (id) { @@ -52,6 +56,38 @@ function getDailyVolume (id) { }) } +/** + * Format and populate fields + * for customer record + * + * @function format + * + * @param {object} customer Customer object + * @returns {object} Customer camelized & populated with computed fields + */ +function format (customer) { + /** + * Populate with status field + * + */ + const status = _.maxBy('value', [{ + label: 'Phone', + value: customer.phone_at + }, { + label: 'ID card', + value: customer.id_card_at + }, { + label: 'Front facing camera', + value: customer.front_facing_cam_at + }, { + label: 'ID card image', + value: customer.id_card_image_at + }]) + customer.status = status.label + + return camelize(customer) +} + /** * Query all customers * @@ -62,20 +98,13 @@ function getDailyVolume (id) { * @returns {array} Array of customers populated with status field */ function batch () { - const sql = `select - CASE GREATEST( - phone_at, - id_card_at, - front_facing_cam_at, - id_card_image_at - ) - WHEN phone_at THEN 'Phone' - WHEN id_card_at THEN 'ID card' - WHEN front_facing_cam_at THEN 'Front facing camera' - WHEN id_card_image_at THEN 'ID card image' - END AS status, * from customers + const sql = `select * from customers where id != $1 order by created desc limit $2` return db.any(sql, [ anonymous.uuid, NUM_RESULTS ]) + .then(customers => { + return _.map(customer => format(customer), customers) + }) } + module.exports = { add, get, batch, getById, patch} diff --git a/public/elm.js b/public/elm.js index 6685f42e..295f8e75 100644 --- a/public/elm.js +++ b/public/elm.js @@ -31953,12 +31953,12 @@ var _user$project$BasicTypes$Saving = {ctor: 'Saving'}; var _user$project$Common_Customer_Types$Customer = F7( function (a, b, c, d, e, f, g) { - return {id: a, name: b, phone: c, phone_at: d, created: e, status: f, authorized_override: g}; + return {id: a, name: b, phone: c, phone_at: d, created: e, status: f, authorizedOverride: g}; }); var _user$project$Common_Customer_Decoder$customerDecoder = A4( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$optional, - 'authorized_override', + 'authorizedOverride', _elm_lang$core$Json_Decode$string, 'blocked', A4( @@ -31972,8 +31972,8 @@ var _user$project$Common_Customer_Decoder$customerDecoder = A4( _elm_community$json_extra$Json_Decode_Extra$date, A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'phone_at', - _elm_community$json_extra$Json_Decode_Extra$date, + 'phoneAt', + _elm_lang$core$Json_Decode$nullable(_elm_community$json_extra$Json_Decode_Extra$date), A4( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$optional, 'phone', @@ -37991,7 +37991,7 @@ var _user$project$Customer_Rest$updateCustomer = F2( A2( _elm_lang$core$Basics_ops['++'], id, - A2(_elm_lang$core$Basics_ops['++'], '?authorized_override=', action))))))); + A2(_elm_lang$core$Basics_ops['++'], '?authorizedOverride=', action))))))); }); var _user$project$Customer_State$update = F2( @@ -38032,8 +38032,16 @@ var _user$project$Customer_State$load = function (id) { }; var _user$project$Customer_State$init = _krisajenkins$remotedata$RemoteData$NotAsked; +var _user$project$Customer_View$formatDate = function (date) { + var _p0 = date; + if (_p0.ctor === 'Just') { + return A2(_justinmimbs$elm_date_extra$Date_Extra$toFormattedString, 'yyyy-MM-dd HH:mm', _p0._0); + } else { + return ''; + } +}; var _user$project$Customer_View$customerActions = function (customer) { - return _elm_lang$core$Native_Utils.eq(customer.authorized_override, 'blocked') ? A2( + return _elm_lang$core$Native_Utils.eq(customer.authorizedOverride, 'blocked') ? A2( _elm_lang$html$Html$button, { ctor: '::', @@ -38199,7 +38207,7 @@ var _user$project$Customer_View$customerView = function (customer) { { ctor: '::', _0: _elm_lang$html$Html$text( - A2(_justinmimbs$elm_date_extra$Date_Extra$toFormattedString, 'yyyy-MM-dd HH:mm', customer.phone_at)), + _user$project$Customer_View$formatDate(customer.phone_at)), _1: {ctor: '[]'} }), _1: {ctor: '[]'} @@ -38276,8 +38284,8 @@ var _user$project$Customer_View$customerView = function (customer) { }); }; var _user$project$Customer_View$view = function (model) { - var _p0 = model; - switch (_p0.ctor) { + var _p1 = model; + switch (_p1.ctor) { case 'NotAsked': return A2( _elm_lang$html$Html$div, @@ -38299,7 +38307,7 @@ var _user$project$Customer_View$view = function (model) { { ctor: '::', _0: _elm_lang$html$Html$text( - _elm_lang$core$Basics$toString(_p0._0)), + _elm_lang$core$Basics$toString(_p1._0)), _1: {ctor: '[]'} }); default: @@ -38308,7 +38316,7 @@ var _user$project$Customer_View$view = function (model) { {ctor: '[]'}, { ctor: '::', - _0: _user$project$Customer_View$customerView(_p0._0), + _0: _user$project$Customer_View$customerView(_p1._0), _1: {ctor: '[]'} }); } @@ -41196,7 +41204,7 @@ var _user$project$Main$Model = function (a) { var Elm = {}; Elm['Main'] = Elm['Main'] || {}; if (typeof _user$project$Main$main !== 'undefined') { - _user$project$Main$main(Elm['Main'], 'Main', {"types":{"unions":{"Selectize.Status":{"args":[],"tags":{"Editing":[],"Idle":[],"Blurred":[],"Cleared":[],"Initial":[]}},"BasicTypes.SavingStatus":{"args":[],"tags":{"Saving":[],"Editing":[],"NotSaving":[],"Saved":[]}},"Dict.LeafColor":{"args":[],"tags":{"LBBlack":[],"LBlack":[]}},"Account.SavingStatus":{"args":[],"tags":{"Saving":[],"Editing":[],"NotSaving":[],"Saved":[]}},"ConfigTypes.ConfigScope":{"args":[],"tags":{"Specific":[],"Both":[],"Global":[]}},"FieldSet.Types.Msg":{"args":[],"tags":{"Input":["String","String"]}},"ConfigTypes.FieldType":{"args":[],"tags":{"FieldOnOffType":[],"FieldPercentageType":[],"FieldLanguageType":[],"FieldCryptoCurrencyType":[],"FieldDecimalType":[],"FieldIntegerType":[],"FieldFiatCurrencyType":[],"FieldStringType":[],"FieldCountryType":[],"FieldAccountType":[]}},"Customers.Types.Msg":{"args":[],"tags":{"Load":["Customers.Types.Model"]}},"Pair.Msg":{"args":[],"tags":{"SubmitName":[],"Load":["RemoteData.WebData String"],"InputName":["String"]}},"Dict.Dict":{"args":["k","v"],"tags":{"RBNode_elm_builtin":["Dict.NColor","k","v","Dict.Dict k v","Dict.Dict k v"],"RBEmpty_elm_builtin":["Dict.LeafColor"]}},"ConfigTypes.DisplayTop":{"args":[],"tags":{"DisplayTopSolo":["String"],"DisplayTopLeader":["Int","String"],"DisplayTopNone":[]}},"Customer.Types.Msg":{"args":[],"tags":{"UnBlockCustomer":["String"],"Load":["Customer.Types.Model"],"BlockCustomer":["String"]}},"Date.Date":{"args":[],"tags":{"Date":[]}},"Account.Msg":{"args":[],"tags":{"Load":["Account.Model"],"FieldSetMsg":["FieldSet.Types.Msg"],"Submit":[],"HideSaveIndication":[]}},"MaintenanceFunding.Types.Msg":{"args":[],"tags":{"Load":["MaintenanceFunding.Types.Model"],"CryptoSwitch":["String"]}},"Common.TransactionTypes.Tx":{"args":[],"tags":{"CashInTx":["Common.TransactionTypes.CashInTxRec"],"CashOutTx":["Common.TransactionTypes.CashOutTxRec"]}},"Maybe.Maybe":{"args":["a"],"tags":{"Just":["a"],"Nothing":[]}},"Transaction.Types.Msg":{"args":[],"tags":{"Load":["Transaction.Types.Model"],"HideSaveIndication":[],"Cancel":["String"]}},"RemoteData.RemoteData":{"args":["e","a"],"tags":{"NotAsked":[],"Success":["a"],"Loading":[],"Failure":["e"]}},"MaintenanceMachines.Types.Msg":{"args":[],"tags":{"Action":[],"Load":["MaintenanceMachines.Types.Model"],"InputCassette":["MaintenanceMachines.Types.Machine","MaintenanceMachines.Types.Position","String"],"Submit":["MaintenanceMachines.Types.MachineAction"],"HideSaveIndication":[]}},"ConfigTypes.Crypto":{"args":[],"tags":{"GlobalCrypto":[],"CryptoCode":["String"]}},"CoreTypes.Msg":{"args":[],"tags":{"WebSocketMsg":["String"],"ConfigMsg":["Config.Msg"],"CustomersMsg":["Customers.Types.Msg"],"TransactionsMsg":["Transactions.Msg"],"LoadAccounts":["List ( String, String )"],"NewUrl":["String"],"Interval":[],"MaintenanceMachinesMsg":["MaintenanceMachines.Types.Msg"],"LoadStatus":["StatusTypes.WebStatus"],"UrlChange":["Navigation.Location"],"TransactionMsg":["Transaction.Types.Msg"],"MaintenanceFundingMsg":["MaintenanceFunding.Types.Msg"],"CustomerMsg":["Customer.Types.Msg"],"AccountMsg":["Account.Msg"],"PairMsg":["Pair.Msg"]}},"Dict.NColor":{"args":[],"tags":{"BBlack":[],"Red":[],"NBlack":[],"Black":[]}},"FieldSet.Types.FieldValue":{"args":[],"tags":{"FieldInteger":["Int"],"FieldString":["String"],"FieldPassword":["FieldSet.Types.FieldPasswordType"]}},"ConfigTypes.Machine":{"args":[],"tags":{"MachineId":["String"],"GlobalMachine":[]}},"Config.Msg":{"args":[],"tags":{"Focus":["ConfigTypes.FieldLocator"],"BlurSelectize":["ConfigTypes.FieldLocator","Selectize.State"],"Remove":["ConfigTypes.FieldLocator","Selectize.State"],"Load":["Config.WebConfigGroup"],"Input":["ConfigTypes.FieldLocator","String"],"Blur":["ConfigTypes.FieldLocator"],"Add":["ConfigTypes.FieldLocator","String","Selectize.State"],"Submit":[],"SelectizeMsg":["ConfigTypes.FieldLocator","Selectize.State"],"FocusSelectize":["ConfigTypes.FieldLocator","Selectize.State"],"HideSaveIndication":[],"NoOp":[],"CryptoSwitch":["ConfigTypes.Crypto"]}},"Transactions.Msg":{"args":[],"tags":{"Load":["Transactions.Model"]}},"ConfigTypes.FieldValidator":{"args":[],"tags":{"FieldRequired":[],"FieldMin":["Int"],"FieldMax":["Int"]}},"MaintenanceMachines.Types.MachineAction":{"args":[],"tags":{"RebootMachine":["MaintenanceMachines.Types.Machine"],"ResetCashOutBills":["MaintenanceMachines.Types.Machine"],"UnpairMachine":["MaintenanceMachines.Types.Machine"]}},"Http.Error":{"args":[],"tags":{"BadUrl":["String"],"NetworkError":[],"Timeout":[],"BadStatus":["Http.Response String"],"BadPayload":["String","Http.Response String"]}},"ConfigTypes.FieldValue":{"args":[],"tags":{"FieldIntegerValue":["Int"],"FieldDecimalValue":["Float"],"FieldCryptoCurrencyValue":["List String"],"FieldCountryValue":["String"],"FieldFiatCurrencyValue":["String"],"FieldStringValue":["String"],"FieldOnOffValue":["Bool"],"FieldAccountValue":["String"],"FieldLanguageValue":["List String"],"FieldPercentageValue":["Float"]}},"FieldSet.Types.FieldPasswordType":{"args":[],"tags":{"PasswordEmpty":[],"PasswordHidden":[],"Password":["String"]}},"MaintenanceMachines.Types.Position":{"args":[],"tags":{"Bottom":[],"Top":[]}}},"aliases":{"ConfigTypes.ConfigSchema":{"args":[],"type":"{ code : String , display : String , cryptoScope : ConfigTypes.ConfigScope , machineScope : ConfigTypes.ConfigScope , entries : List ConfigTypes.FieldDescriptor }"},"Selectize.State":{"args":[],"type":"{ boxPosition : Int, status : Selectize.Status, string : String }"},"RemoteData.WebData":{"args":["a"],"type":"RemoteData.RemoteData Http.Error a"},"ConfigTypes.FieldLocator":{"args":[],"type":"{ fieldScope : ConfigTypes.FieldScope , code : String , fieldType : ConfigTypes.FieldType , fieldClass : Maybe.Maybe String }"},"AccountTypes.Account":{"args":[],"type":"{ code : String , display : String , fields : List FieldSet.Types.Field }"},"Http.Response":{"args":["body"],"type":"{ url : String , status : { code : Int, message : String } , headers : Dict.Dict String String , body : body }"},"StatusTypes.WebStatus":{"args":[],"type":"RemoteData.WebData StatusTypes.StatusRec"},"Common.TransactionTypes.CashOutTxRec":{"args":[],"type":"{ id : String , machineName : String , toAddress : String , cryptoAtoms : Int , cryptoCode : String , fiat : Float , fiatCode : String , status : String , dispense : Bool , notified : Bool , redeemed : Bool , phone : Maybe.Maybe String , error : Maybe.Maybe String , created : Date.Date , confirmed : Bool }"},"MaintenanceMachines.Types.Machine":{"args":[],"type":"{ deviceId : String , name : String , cashbox : Int , cassette1 : Int , cassette2 : Int , paired : Bool , cashOut : Bool }"},"ConfigTypes.ConfigData":{"args":[],"type":"{ cryptoCurrencies : List ConfigTypes.CryptoDisplay , currencies : List ConfigTypes.DisplayRec , languages : List ConfigTypes.DisplayRec , countries : List ConfigTypes.DisplayRec , accounts : List ConfigTypes.AccountRec , machines : List ConfigTypes.MachineDisplay }"},"Transaction.Types.Model":{"args":[],"type":"RemoteData.WebData Transaction.Types.SubModel"},"Account.Model":{"args":[],"type":"RemoteData.WebData Account.SubModel"},"Customer.Types.Model":{"args":[],"type":"RemoteData.WebData Common.Customer.Types.Customer"},"MaintenanceFunding.Types.Model":{"args":[],"type":"RemoteData.WebData MaintenanceFunding.Types.SubModel"},"Common.Customer.Types.Customers":{"args":[],"type":"List Common.Customer.Types.Customer"},"MaintenanceFunding.Types.CryptoDisplay":{"args":[],"type":"{ cryptoCode : String, display : String }"},"ConfigTypes.CryptoDisplay":{"args":[],"type":"{ crypto : ConfigTypes.Crypto, display : String }"},"Config.WebConfigGroup":{"args":[],"type":"RemoteData.WebData ConfigTypes.ConfigGroup"},"FieldSet.Types.Field":{"args":[],"type":"{ code : String , display : String , placeholder : String , required : Bool , value : FieldSet.Types.FieldValue , loadedValue : FieldSet.Types.FieldValue }"},"ConfigTypes.DisplayRec":{"args":[],"type":"{ code : String, display : String }"},"Transaction.Types.SubModel":{"args":[],"type":"{ status : BasicTypes.SavingStatus, tx : Common.TransactionTypes.Tx }"},"Account.SubModel":{"args":[],"type":"{ status : Account.SavingStatus, account : AccountTypes.Account }"},"MaintenanceFunding.Types.SubModel":{"args":[],"type":"{ cryptoCode : String , cryptoDisplays : List MaintenanceFunding.Types.CryptoDisplay , fundingAddress : String , fundingAddressUrl : String , confirmedBalance : String , pending : String , fiatConfirmedBalance : String , fiatPending : String , fiatCode : String }"},"Common.TransactionTypes.CashInTxRec":{"args":[],"type":"{ id : String , machineName : String , toAddress : String , cryptoAtoms : Int , cryptoCode : String , fiat : Float , fiatCode : String , txHash : Maybe.Maybe String , phone : Maybe.Maybe String , error : Maybe.Maybe String , operatorCompleted : Bool , send : Bool , sendConfirmed : Bool , expired : Bool , created : Date.Date }"},"ConfigTypes.FieldScope":{"args":[],"type":"{ crypto : ConfigTypes.Crypto, machine : ConfigTypes.Machine }"},"MaintenanceMachines.Types.Model":{"args":[],"type":"RemoteData.WebData MaintenanceMachines.Types.SubModel"},"ConfigTypes.ConfigGroup":{"args":[],"type":"{ schema : ConfigTypes.ConfigSchema , values : List ConfigTypes.Field , selectedCryptos : List String , data : ConfigTypes.ConfigData }"},"ConfigTypes.AccountRec":{"args":[],"type":"{ code : String , display : String , class : String , cryptos : Maybe.Maybe (List ConfigTypes.Crypto) }"},"ConfigTypes.Field":{"args":[],"type":"{ fieldLocator : ConfigTypes.FieldLocator , fieldValue : ConfigTypes.FieldValue , fieldEnabledIfAny : List String , fieldEnabledIfAll : List String , inScope : Bool }"},"ConfigTypes.MachineDisplay":{"args":[],"type":"{ machine : ConfigTypes.Machine, display : String }"},"Common.Customer.Types.Customer":{"args":[],"type":"{ id : String , name : String , phone : String , phone_at : Date.Date , created : Date.Date , status : String , authorized_override : String }"},"StatusTypes.ServerRec":{"args":[],"type":"{ up : Bool , lastPing : Maybe.Maybe String , rates : List StatusTypes.Rate , machineStatus : String , wasConfigured : Bool }"},"MaintenanceMachines.Types.SubModel":{"args":[],"type":"{ status : BasicTypes.SavingStatus , machines : MaintenanceMachines.Types.Machines }"},"StatusTypes.Rate":{"args":[],"type":"{ crypto : String, bid : Float, ask : Float }"},"Customers.Types.Model":{"args":[],"type":"RemoteData.WebData Common.Customer.Types.Customers"},"Transactions.Txs":{"args":[],"type":"List Common.TransactionTypes.Tx"},"MaintenanceMachines.Types.Machines":{"args":[],"type":"List MaintenanceMachines.Types.Machine"},"Transactions.Model":{"args":[],"type":"RemoteData.WebData Transactions.Txs"},"ConfigTypes.FieldDescriptor":{"args":[],"type":"{ code : String , cryptoScope : ConfigTypes.ConfigScope , machineScope : ConfigTypes.ConfigScope , displayTop : ConfigTypes.DisplayTop , displayBottom : String , displayCount : Maybe.Maybe Int , fieldType : ConfigTypes.FieldType , fieldValidation : List ConfigTypes.FieldValidator , fieldClass : Maybe.Maybe String , fieldEnabledIfAny : List String , fieldEnabledIfAll : List String , readOnly : Bool }"},"StatusTypes.StatusRec":{"args":[],"type":"{ server : StatusTypes.ServerRec, invalidConfigGroups : List String }"},"Navigation.Location":{"args":[],"type":"{ href : String , host : String , hostname : String , protocol : String , origin : String , port_ : String , pathname : String , search : String , hash : String , username : String , password : String }"}},"message":"CoreTypes.Msg"},"versions":{"elm":"0.18.0"}}); + _user$project$Main$main(Elm['Main'], 'Main', {"types":{"unions":{"Selectize.Status":{"args":[],"tags":{"Editing":[],"Idle":[],"Blurred":[],"Cleared":[],"Initial":[]}},"BasicTypes.SavingStatus":{"args":[],"tags":{"Saving":[],"Editing":[],"NotSaving":[],"Saved":[]}},"Dict.LeafColor":{"args":[],"tags":{"LBBlack":[],"LBlack":[]}},"Account.SavingStatus":{"args":[],"tags":{"Saving":[],"Editing":[],"NotSaving":[],"Saved":[]}},"ConfigTypes.ConfigScope":{"args":[],"tags":{"Specific":[],"Both":[],"Global":[]}},"FieldSet.Types.Msg":{"args":[],"tags":{"Input":["String","String"]}},"ConfigTypes.FieldType":{"args":[],"tags":{"FieldOnOffType":[],"FieldPercentageType":[],"FieldLanguageType":[],"FieldCryptoCurrencyType":[],"FieldDecimalType":[],"FieldIntegerType":[],"FieldFiatCurrencyType":[],"FieldStringType":[],"FieldCountryType":[],"FieldAccountType":[]}},"Customers.Types.Msg":{"args":[],"tags":{"Load":["Customers.Types.Model"]}},"Pair.Msg":{"args":[],"tags":{"SubmitName":[],"Load":["RemoteData.WebData String"],"InputName":["String"]}},"Dict.Dict":{"args":["k","v"],"tags":{"RBNode_elm_builtin":["Dict.NColor","k","v","Dict.Dict k v","Dict.Dict k v"],"RBEmpty_elm_builtin":["Dict.LeafColor"]}},"ConfigTypes.DisplayTop":{"args":[],"tags":{"DisplayTopSolo":["String"],"DisplayTopLeader":["Int","String"],"DisplayTopNone":[]}},"Customer.Types.Msg":{"args":[],"tags":{"UnBlockCustomer":["String"],"Load":["Customer.Types.Model"],"BlockCustomer":["String"]}},"Date.Date":{"args":[],"tags":{"Date":[]}},"Account.Msg":{"args":[],"tags":{"Load":["Account.Model"],"FieldSetMsg":["FieldSet.Types.Msg"],"Submit":[],"HideSaveIndication":[]}},"MaintenanceFunding.Types.Msg":{"args":[],"tags":{"Load":["MaintenanceFunding.Types.Model"],"CryptoSwitch":["String"]}},"Common.TransactionTypes.Tx":{"args":[],"tags":{"CashInTx":["Common.TransactionTypes.CashInTxRec"],"CashOutTx":["Common.TransactionTypes.CashOutTxRec"]}},"Maybe.Maybe":{"args":["a"],"tags":{"Just":["a"],"Nothing":[]}},"Transaction.Types.Msg":{"args":[],"tags":{"Load":["Transaction.Types.Model"],"HideSaveIndication":[],"Cancel":["String"]}},"RemoteData.RemoteData":{"args":["e","a"],"tags":{"NotAsked":[],"Success":["a"],"Loading":[],"Failure":["e"]}},"MaintenanceMachines.Types.Msg":{"args":[],"tags":{"Action":[],"Load":["MaintenanceMachines.Types.Model"],"InputCassette":["MaintenanceMachines.Types.Machine","MaintenanceMachines.Types.Position","String"],"Submit":["MaintenanceMachines.Types.MachineAction"],"HideSaveIndication":[]}},"ConfigTypes.Crypto":{"args":[],"tags":{"GlobalCrypto":[],"CryptoCode":["String"]}},"CoreTypes.Msg":{"args":[],"tags":{"WebSocketMsg":["String"],"ConfigMsg":["Config.Msg"],"CustomersMsg":["Customers.Types.Msg"],"TransactionsMsg":["Transactions.Msg"],"LoadAccounts":["List ( String, String )"],"NewUrl":["String"],"Interval":[],"MaintenanceMachinesMsg":["MaintenanceMachines.Types.Msg"],"LoadStatus":["StatusTypes.WebStatus"],"UrlChange":["Navigation.Location"],"TransactionMsg":["Transaction.Types.Msg"],"MaintenanceFundingMsg":["MaintenanceFunding.Types.Msg"],"CustomerMsg":["Customer.Types.Msg"],"AccountMsg":["Account.Msg"],"PairMsg":["Pair.Msg"]}},"Dict.NColor":{"args":[],"tags":{"BBlack":[],"Red":[],"NBlack":[],"Black":[]}},"FieldSet.Types.FieldValue":{"args":[],"tags":{"FieldInteger":["Int"],"FieldString":["String"],"FieldPassword":["FieldSet.Types.FieldPasswordType"]}},"ConfigTypes.Machine":{"args":[],"tags":{"MachineId":["String"],"GlobalMachine":[]}},"Config.Msg":{"args":[],"tags":{"Focus":["ConfigTypes.FieldLocator"],"BlurSelectize":["ConfigTypes.FieldLocator","Selectize.State"],"Remove":["ConfigTypes.FieldLocator","Selectize.State"],"Load":["Config.WebConfigGroup"],"Input":["ConfigTypes.FieldLocator","String"],"Blur":["ConfigTypes.FieldLocator"],"Add":["ConfigTypes.FieldLocator","String","Selectize.State"],"Submit":[],"SelectizeMsg":["ConfigTypes.FieldLocator","Selectize.State"],"FocusSelectize":["ConfigTypes.FieldLocator","Selectize.State"],"HideSaveIndication":[],"NoOp":[],"CryptoSwitch":["ConfigTypes.Crypto"]}},"Transactions.Msg":{"args":[],"tags":{"Load":["Transactions.Model"]}},"ConfigTypes.FieldValidator":{"args":[],"tags":{"FieldRequired":[],"FieldMin":["Int"],"FieldMax":["Int"]}},"MaintenanceMachines.Types.MachineAction":{"args":[],"tags":{"RebootMachine":["MaintenanceMachines.Types.Machine"],"ResetCashOutBills":["MaintenanceMachines.Types.Machine"],"UnpairMachine":["MaintenanceMachines.Types.Machine"]}},"Http.Error":{"args":[],"tags":{"BadUrl":["String"],"NetworkError":[],"Timeout":[],"BadStatus":["Http.Response String"],"BadPayload":["String","Http.Response String"]}},"ConfigTypes.FieldValue":{"args":[],"tags":{"FieldIntegerValue":["Int"],"FieldDecimalValue":["Float"],"FieldCryptoCurrencyValue":["List String"],"FieldCountryValue":["String"],"FieldFiatCurrencyValue":["String"],"FieldStringValue":["String"],"FieldOnOffValue":["Bool"],"FieldAccountValue":["String"],"FieldLanguageValue":["List String"],"FieldPercentageValue":["Float"]}},"FieldSet.Types.FieldPasswordType":{"args":[],"tags":{"PasswordEmpty":[],"PasswordHidden":[],"Password":["String"]}},"MaintenanceMachines.Types.Position":{"args":[],"tags":{"Bottom":[],"Top":[]}}},"aliases":{"ConfigTypes.ConfigSchema":{"args":[],"type":"{ code : String , display : String , cryptoScope : ConfigTypes.ConfigScope , machineScope : ConfigTypes.ConfigScope , entries : List ConfigTypes.FieldDescriptor }"},"Selectize.State":{"args":[],"type":"{ boxPosition : Int, status : Selectize.Status, string : String }"},"RemoteData.WebData":{"args":["a"],"type":"RemoteData.RemoteData Http.Error a"},"ConfigTypes.FieldLocator":{"args":[],"type":"{ fieldScope : ConfigTypes.FieldScope , code : String , fieldType : ConfigTypes.FieldType , fieldClass : Maybe.Maybe String }"},"AccountTypes.Account":{"args":[],"type":"{ code : String , display : String , fields : List FieldSet.Types.Field }"},"Http.Response":{"args":["body"],"type":"{ url : String , status : { code : Int, message : String } , headers : Dict.Dict String String , body : body }"},"StatusTypes.WebStatus":{"args":[],"type":"RemoteData.WebData StatusTypes.StatusRec"},"Common.TransactionTypes.CashOutTxRec":{"args":[],"type":"{ id : String , machineName : String , toAddress : String , cryptoAtoms : Int , cryptoCode : String , fiat : Float , fiatCode : String , status : String , dispense : Bool , notified : Bool , redeemed : Bool , phone : Maybe.Maybe String , error : Maybe.Maybe String , created : Date.Date , confirmed : Bool }"},"MaintenanceMachines.Types.Machine":{"args":[],"type":"{ deviceId : String , name : String , cashbox : Int , cassette1 : Int , cassette2 : Int , paired : Bool , cashOut : Bool }"},"ConfigTypes.ConfigData":{"args":[],"type":"{ cryptoCurrencies : List ConfigTypes.CryptoDisplay , currencies : List ConfigTypes.DisplayRec , languages : List ConfigTypes.DisplayRec , countries : List ConfigTypes.DisplayRec , accounts : List ConfigTypes.AccountRec , machines : List ConfigTypes.MachineDisplay }"},"Transaction.Types.Model":{"args":[],"type":"RemoteData.WebData Transaction.Types.SubModel"},"Account.Model":{"args":[],"type":"RemoteData.WebData Account.SubModel"},"Customer.Types.Model":{"args":[],"type":"RemoteData.WebData Common.Customer.Types.Customer"},"MaintenanceFunding.Types.Model":{"args":[],"type":"RemoteData.WebData MaintenanceFunding.Types.SubModel"},"Common.Customer.Types.Customers":{"args":[],"type":"List Common.Customer.Types.Customer"},"MaintenanceFunding.Types.CryptoDisplay":{"args":[],"type":"{ cryptoCode : String, display : String }"},"ConfigTypes.CryptoDisplay":{"args":[],"type":"{ crypto : ConfigTypes.Crypto, display : String }"},"Config.WebConfigGroup":{"args":[],"type":"RemoteData.WebData ConfigTypes.ConfigGroup"},"FieldSet.Types.Field":{"args":[],"type":"{ code : String , display : String , placeholder : String , required : Bool , value : FieldSet.Types.FieldValue , loadedValue : FieldSet.Types.FieldValue }"},"ConfigTypes.DisplayRec":{"args":[],"type":"{ code : String, display : String }"},"Transaction.Types.SubModel":{"args":[],"type":"{ status : BasicTypes.SavingStatus, tx : Common.TransactionTypes.Tx }"},"Account.SubModel":{"args":[],"type":"{ status : Account.SavingStatus, account : AccountTypes.Account }"},"MaintenanceFunding.Types.SubModel":{"args":[],"type":"{ cryptoCode : String , cryptoDisplays : List MaintenanceFunding.Types.CryptoDisplay , fundingAddress : String , fundingAddressUrl : String , confirmedBalance : String , pending : String , fiatConfirmedBalance : String , fiatPending : String , fiatCode : String }"},"Common.TransactionTypes.CashInTxRec":{"args":[],"type":"{ id : String , machineName : String , toAddress : String , cryptoAtoms : Int , cryptoCode : String , fiat : Float , fiatCode : String , txHash : Maybe.Maybe String , phone : Maybe.Maybe String , error : Maybe.Maybe String , operatorCompleted : Bool , send : Bool , sendConfirmed : Bool , expired : Bool , created : Date.Date }"},"ConfigTypes.FieldScope":{"args":[],"type":"{ crypto : ConfigTypes.Crypto, machine : ConfigTypes.Machine }"},"MaintenanceMachines.Types.Model":{"args":[],"type":"RemoteData.WebData MaintenanceMachines.Types.SubModel"},"ConfigTypes.ConfigGroup":{"args":[],"type":"{ schema : ConfigTypes.ConfigSchema , values : List ConfigTypes.Field , selectedCryptos : List String , data : ConfigTypes.ConfigData }"},"ConfigTypes.AccountRec":{"args":[],"type":"{ code : String , display : String , class : String , cryptos : Maybe.Maybe (List ConfigTypes.Crypto) }"},"ConfigTypes.Field":{"args":[],"type":"{ fieldLocator : ConfigTypes.FieldLocator , fieldValue : ConfigTypes.FieldValue , fieldEnabledIfAny : List String , fieldEnabledIfAll : List String , inScope : Bool }"},"ConfigTypes.MachineDisplay":{"args":[],"type":"{ machine : ConfigTypes.Machine, display : String }"},"Common.Customer.Types.Customer":{"args":[],"type":"{ id : String , name : String , phone : String , phone_at : Maybe.Maybe Date.Date , created : Date.Date , status : String , authorizedOverride : String }"},"StatusTypes.ServerRec":{"args":[],"type":"{ up : Bool , lastPing : Maybe.Maybe String , rates : List StatusTypes.Rate , machineStatus : String , wasConfigured : Bool }"},"MaintenanceMachines.Types.SubModel":{"args":[],"type":"{ status : BasicTypes.SavingStatus , machines : MaintenanceMachines.Types.Machines }"},"StatusTypes.Rate":{"args":[],"type":"{ crypto : String, bid : Float, ask : Float }"},"Customers.Types.Model":{"args":[],"type":"RemoteData.WebData Common.Customer.Types.Customers"},"Transactions.Txs":{"args":[],"type":"List Common.TransactionTypes.Tx"},"MaintenanceMachines.Types.Machines":{"args":[],"type":"List MaintenanceMachines.Types.Machine"},"Transactions.Model":{"args":[],"type":"RemoteData.WebData Transactions.Txs"},"ConfigTypes.FieldDescriptor":{"args":[],"type":"{ code : String , cryptoScope : ConfigTypes.ConfigScope , machineScope : ConfigTypes.ConfigScope , displayTop : ConfigTypes.DisplayTop , displayBottom : String , displayCount : Maybe.Maybe Int , fieldType : ConfigTypes.FieldType , fieldValidation : List ConfigTypes.FieldValidator , fieldClass : Maybe.Maybe String , fieldEnabledIfAny : List String , fieldEnabledIfAll : List String , readOnly : Bool }"},"StatusTypes.StatusRec":{"args":[],"type":"{ server : StatusTypes.ServerRec, invalidConfigGroups : List String }"},"Navigation.Location":{"args":[],"type":"{ href : String , host : String , hostname : String , protocol : String , origin : String , port_ : String , pathname : String , search : String , hash : String , username : String , password : String }"}},"message":"CoreTypes.Msg"},"versions":{"elm":"0.18.0"}}); } if (typeof define === "function" && define['amd'])