module TD.Query.ValidateOrderInfo
(ValidateOrderInfo(..)
, defaultValidateOrderInfo
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.InputInvoice as InputInvoice
import qualified TD.Data.OrderInfo as OrderInfo
data ValidateOrderInfo
= ValidateOrderInfo
{ ValidateOrderInfo -> Maybe InputInvoice
input_invoice :: Maybe InputInvoice.InputInvoice
, ValidateOrderInfo -> Maybe OrderInfo
order_info :: Maybe OrderInfo.OrderInfo
, ValidateOrderInfo -> Maybe Bool
allow_save :: Maybe Bool
}
deriving (ValidateOrderInfo -> ValidateOrderInfo -> Bool
(ValidateOrderInfo -> ValidateOrderInfo -> Bool)
-> (ValidateOrderInfo -> ValidateOrderInfo -> Bool)
-> Eq ValidateOrderInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ValidateOrderInfo -> ValidateOrderInfo -> Bool
== :: ValidateOrderInfo -> ValidateOrderInfo -> Bool
$c/= :: ValidateOrderInfo -> ValidateOrderInfo -> Bool
/= :: ValidateOrderInfo -> ValidateOrderInfo -> Bool
Eq, Int -> ValidateOrderInfo -> ShowS
[ValidateOrderInfo] -> ShowS
ValidateOrderInfo -> String
(Int -> ValidateOrderInfo -> ShowS)
-> (ValidateOrderInfo -> String)
-> ([ValidateOrderInfo] -> ShowS)
-> Show ValidateOrderInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ValidateOrderInfo -> ShowS
showsPrec :: Int -> ValidateOrderInfo -> ShowS
$cshow :: ValidateOrderInfo -> String
show :: ValidateOrderInfo -> String
$cshowList :: [ValidateOrderInfo] -> ShowS
showList :: [ValidateOrderInfo] -> ShowS
Show)
instance I.ShortShow ValidateOrderInfo where
shortShow :: ValidateOrderInfo -> String
shortShow
ValidateOrderInfo
{ input_invoice :: ValidateOrderInfo -> Maybe InputInvoice
input_invoice = Maybe InputInvoice
input_invoice_
, order_info :: ValidateOrderInfo -> Maybe OrderInfo
order_info = Maybe OrderInfo
order_info_
, allow_save :: ValidateOrderInfo -> Maybe Bool
allow_save = Maybe Bool
allow_save_
}
= String
"ValidateOrderInfo"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"input_invoice" String -> Maybe InputInvoice -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputInvoice
input_invoice_
, String
"order_info" String -> Maybe OrderInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe OrderInfo
order_info_
, String
"allow_save" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
allow_save_
]
instance AT.ToJSON ValidateOrderInfo where
toJSON :: ValidateOrderInfo -> Value
toJSON
ValidateOrderInfo
{ input_invoice :: ValidateOrderInfo -> Maybe InputInvoice
input_invoice = Maybe InputInvoice
input_invoice_
, order_info :: ValidateOrderInfo -> Maybe OrderInfo
order_info = Maybe OrderInfo
order_info_
, allow_save :: ValidateOrderInfo -> Maybe Bool
allow_save = Maybe Bool
allow_save_
}
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"validateOrderInfo"
, Key
"input_invoice" Key -> Maybe InputInvoice -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputInvoice
input_invoice_
, Key
"order_info" Key -> Maybe OrderInfo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe OrderInfo
order_info_
, Key
"allow_save" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
allow_save_
]
defaultValidateOrderInfo :: ValidateOrderInfo
defaultValidateOrderInfo :: ValidateOrderInfo
defaultValidateOrderInfo =
ValidateOrderInfo
{ input_invoice :: Maybe InputInvoice
input_invoice = Maybe InputInvoice
forall a. Maybe a
Nothing
, order_info :: Maybe OrderInfo
order_info = Maybe OrderInfo
forall a. Maybe a
Nothing
, allow_save :: Maybe Bool
allow_save = Maybe Bool
forall a. Maybe a
Nothing
}