diff --git a/src/Owner.hs b/src/Owner.hs index 630a1fa..029ad4e 100644 --- a/src/Owner.hs +++ b/src/Owner.hs @@ -324,6 +324,7 @@ data OwnerSettings = , os_expiration :: UTCTime , os_payconf :: Bool , os_crmToken :: T.Text + , os_viewKey :: T.Text } deriving (Eq, Show, Generic) @@ -344,10 +345,12 @@ instance FromJSON OwnerSettings where e <- obj .: "expiration" pc <- obj .: "payconf" cT <- obj .: "crmToken" - pure $ OwnerSettings ((Just . read) =<< i) a n c t tV v vV p z inv e pc cT + vK <- obj .: "viewkey" + pure $ + OwnerSettings ((Just . read) =<< i) a n c t tV v vV p z inv e pc cT vK instance ToJSON OwnerSettings where - toJSON (OwnerSettings i a n c t tV v vV p z inv e pc cT) = + toJSON (OwnerSettings i a n c t tV v vV p z inv e pc cT vK) = object [ "_id" .= maybe "" show i , "address" .= a @@ -363,6 +366,7 @@ instance ToJSON OwnerSettings where , "expiration" .= e , "payconf" .= pc , "crmToken" .= cT + , "viewkey" .= (T.take 5 vK <> "...." <> T.takeEnd 5 vK) ] -- Helper Functions @@ -383,6 +387,7 @@ getOwnerSettings o = (oexpiration o) (opayconf o) (ocrmToken o) + (oviewkey o) -- Database actions -- | Function to upsert an Owner