{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} module CoinbasePro.Authenticated.Payment ( PaymentMethodId (..) , PaymentMethod (..) ) where import Data.Aeson.Casing (snakeCase) import Data.Aeson.TH (defaultOptions, deriveJSON, fieldLabelModifier) import Data.Text (Text, toLower, unpack) import Servant.API newtype PaymentMethodId = PaymentMethodId Text deriving PaymentMethodId -> PaymentMethodId -> Bool (PaymentMethodId -> PaymentMethodId -> Bool) -> (PaymentMethodId -> PaymentMethodId -> Bool) -> Eq PaymentMethodId forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: PaymentMethodId -> PaymentMethodId -> Bool $c/= :: PaymentMethodId -> PaymentMethodId -> Bool == :: PaymentMethodId -> PaymentMethodId -> Bool $c== :: PaymentMethodId -> PaymentMethodId -> Bool Eq instance Show PaymentMethodId where show :: PaymentMethodId -> String show (PaymentMethodId Text p) = Text -> String unpack Text p deriveJSON defaultOptions { fieldLabelModifier = snakeCase } ''PaymentMethodId instance ToHttpApiData PaymentMethodId where toUrlPiece :: PaymentMethodId -> Text toUrlPiece (PaymentMethodId Text p) = Text -> Text toLower Text p toQueryParam :: PaymentMethodId -> Text toQueryParam (PaymentMethodId Text p) = Text -> Text toLower Text p data LimitTotal = LimitTotal { LimitTotal -> Double ltAmount :: Double , LimitTotal -> Text ltCurrency :: Text } deriving (LimitTotal -> LimitTotal -> Bool (LimitTotal -> LimitTotal -> Bool) -> (LimitTotal -> LimitTotal -> Bool) -> Eq LimitTotal forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: LimitTotal -> LimitTotal -> Bool $c/= :: LimitTotal -> LimitTotal -> Bool == :: LimitTotal -> LimitTotal -> Bool $c== :: LimitTotal -> LimitTotal -> Bool Eq, Int -> LimitTotal -> ShowS [LimitTotal] -> ShowS LimitTotal -> String (Int -> LimitTotal -> ShowS) -> (LimitTotal -> String) -> ([LimitTotal] -> ShowS) -> Show LimitTotal forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [LimitTotal] -> ShowS $cshowList :: [LimitTotal] -> ShowS show :: LimitTotal -> String $cshow :: LimitTotal -> String showsPrec :: Int -> LimitTotal -> ShowS $cshowsPrec :: Int -> LimitTotal -> ShowS Show) deriveJSON defaultOptions { fieldLabelModifier = snakeCase . drop 2} ''LimitTotal data LimitRemaining = LimitRemaining { LimitRemaining -> Double lrAmount :: Double , LimitRemaining -> Text lrCurrency :: Text } deriving (LimitRemaining -> LimitRemaining -> Bool (LimitRemaining -> LimitRemaining -> Bool) -> (LimitRemaining -> LimitRemaining -> Bool) -> Eq LimitRemaining forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: LimitRemaining -> LimitRemaining -> Bool $c/= :: LimitRemaining -> LimitRemaining -> Bool == :: LimitRemaining -> LimitRemaining -> Bool $c== :: LimitRemaining -> LimitRemaining -> Bool Eq, Int -> LimitRemaining -> ShowS [LimitRemaining] -> ShowS LimitRemaining -> String (Int -> LimitRemaining -> ShowS) -> (LimitRemaining -> String) -> ([LimitRemaining] -> ShowS) -> Show LimitRemaining forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [LimitRemaining] -> ShowS $cshowList :: [LimitRemaining] -> ShowS show :: LimitRemaining -> String $cshow :: LimitRemaining -> String showsPrec :: Int -> LimitRemaining -> ShowS $cshowsPrec :: Int -> LimitRemaining -> ShowS Show) deriveJSON defaultOptions { fieldLabelModifier = snakeCase . drop 2} ''LimitRemaining data Limit = Limit { Limit -> Int periodInDays :: Int , Limit -> LimitTotal total :: LimitTotal , Limit -> LimitRemaining remaining :: LimitRemaining } deriving (Limit -> Limit -> Bool (Limit -> Limit -> Bool) -> (Limit -> Limit -> Bool) -> Eq Limit forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Limit -> Limit -> Bool $c/= :: Limit -> Limit -> Bool == :: Limit -> Limit -> Bool $c== :: Limit -> Limit -> Bool Eq, Int -> Limit -> ShowS [Limit] -> ShowS Limit -> String (Int -> Limit -> ShowS) -> (Limit -> String) -> ([Limit] -> ShowS) -> Show Limit forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Limit] -> ShowS $cshowList :: [Limit] -> ShowS show :: Limit -> String $cshow :: Limit -> String showsPrec :: Int -> Limit -> ShowS $cshowsPrec :: Int -> Limit -> ShowS Show) deriveJSON defaultOptions { fieldLabelModifier = snakeCase } ''Limit data PaymentMethod = PaymentMethod { PaymentMethod -> PaymentMethodId pmId :: PaymentMethodId , PaymentMethod -> Text pmType :: Text , PaymentMethod -> Text pmName :: Text , PaymentMethod -> Text pmCurrency :: Text , PaymentMethod -> Bool pmPrimaryBuy :: Bool , PaymentMethod -> Bool pmPrimarySell :: Bool , PaymentMethod -> Bool pmAllowBuy :: Bool , PaymentMethod -> Bool pmAllowSell :: Bool , PaymentMethod -> Bool pmAllowDeposit :: Bool , PaymentMethod -> Bool pmAllowWithdraw :: Bool , PaymentMethod -> Maybe [Limit] pmBuyLimits :: Maybe [Limit] , PaymentMethod -> Maybe [Limit] pmInstantBuyLimits :: Maybe [Limit] , PaymentMethod -> Maybe [Limit] pmSellLimits :: Maybe [Limit] , PaymentMethod -> Maybe [Limit] pmDepositLimits :: Maybe [Limit] } deriving (PaymentMethod -> PaymentMethod -> Bool (PaymentMethod -> PaymentMethod -> Bool) -> (PaymentMethod -> PaymentMethod -> Bool) -> Eq PaymentMethod forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: PaymentMethod -> PaymentMethod -> Bool $c/= :: PaymentMethod -> PaymentMethod -> Bool == :: PaymentMethod -> PaymentMethod -> Bool $c== :: PaymentMethod -> PaymentMethod -> Bool Eq, Int -> PaymentMethod -> ShowS [PaymentMethod] -> ShowS PaymentMethod -> String (Int -> PaymentMethod -> ShowS) -> (PaymentMethod -> String) -> ([PaymentMethod] -> ShowS) -> Show PaymentMethod forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [PaymentMethod] -> ShowS $cshowList :: [PaymentMethod] -> ShowS show :: PaymentMethod -> String $cshow :: PaymentMethod -> String showsPrec :: Int -> PaymentMethod -> ShowS $cshowsPrec :: Int -> PaymentMethod -> ShowS Show) deriveJSON defaultOptions { fieldLabelModifier = snakeCase . drop 2 } ''PaymentMethod