module TD.Query.SendPaymentForm
(SendPaymentForm(..)
, defaultSendPaymentForm
) 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 Data.Text as T
import qualified TD.Data.InputCredentials as InputCredentials
data SendPaymentForm
= SendPaymentForm
{ SendPaymentForm -> Maybe InputInvoice
input_invoice :: Maybe InputInvoice.InputInvoice
, SendPaymentForm -> Maybe Int
payment_form_id :: Maybe Int
, SendPaymentForm -> Maybe Text
order_info_id :: Maybe T.Text
, SendPaymentForm -> Maybe Text
shipping_option_id :: Maybe T.Text
, SendPaymentForm -> Maybe InputCredentials
credentials :: Maybe InputCredentials.InputCredentials
, SendPaymentForm -> Maybe Int
tip_amount :: Maybe Int
}
deriving (SendPaymentForm -> SendPaymentForm -> Bool
(SendPaymentForm -> SendPaymentForm -> Bool)
-> (SendPaymentForm -> SendPaymentForm -> Bool)
-> Eq SendPaymentForm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendPaymentForm -> SendPaymentForm -> Bool
== :: SendPaymentForm -> SendPaymentForm -> Bool
$c/= :: SendPaymentForm -> SendPaymentForm -> Bool
/= :: SendPaymentForm -> SendPaymentForm -> Bool
Eq, Int -> SendPaymentForm -> ShowS
[SendPaymentForm] -> ShowS
SendPaymentForm -> String
(Int -> SendPaymentForm -> ShowS)
-> (SendPaymentForm -> String)
-> ([SendPaymentForm] -> ShowS)
-> Show SendPaymentForm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendPaymentForm -> ShowS
showsPrec :: Int -> SendPaymentForm -> ShowS
$cshow :: SendPaymentForm -> String
show :: SendPaymentForm -> String
$cshowList :: [SendPaymentForm] -> ShowS
showList :: [SendPaymentForm] -> ShowS
Show)
instance I.ShortShow SendPaymentForm where
shortShow :: SendPaymentForm -> String
shortShow
SendPaymentForm
{ input_invoice :: SendPaymentForm -> Maybe InputInvoice
input_invoice = Maybe InputInvoice
input_invoice_
, payment_form_id :: SendPaymentForm -> Maybe Int
payment_form_id = Maybe Int
payment_form_id_
, order_info_id :: SendPaymentForm -> Maybe Text
order_info_id = Maybe Text
order_info_id_
, shipping_option_id :: SendPaymentForm -> Maybe Text
shipping_option_id = Maybe Text
shipping_option_id_
, credentials :: SendPaymentForm -> Maybe InputCredentials
credentials = Maybe InputCredentials
credentials_
, tip_amount :: SendPaymentForm -> Maybe Int
tip_amount = Maybe Int
tip_amount_
}
= String
"SendPaymentForm"
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
"payment_form_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
payment_form_id_
, String
"order_info_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
order_info_id_
, String
"shipping_option_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
shipping_option_id_
, String
"credentials" String -> Maybe InputCredentials -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputCredentials
credentials_
, String
"tip_amount" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
tip_amount_
]
instance AT.ToJSON SendPaymentForm where
toJSON :: SendPaymentForm -> Value
toJSON
SendPaymentForm
{ input_invoice :: SendPaymentForm -> Maybe InputInvoice
input_invoice = Maybe InputInvoice
input_invoice_
, payment_form_id :: SendPaymentForm -> Maybe Int
payment_form_id = Maybe Int
payment_form_id_
, order_info_id :: SendPaymentForm -> Maybe Text
order_info_id = Maybe Text
order_info_id_
, shipping_option_id :: SendPaymentForm -> Maybe Text
shipping_option_id = Maybe Text
shipping_option_id_
, credentials :: SendPaymentForm -> Maybe InputCredentials
credentials = Maybe InputCredentials
credentials_
, tip_amount :: SendPaymentForm -> Maybe Int
tip_amount = Maybe Int
tip_amount_
}
= [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
"sendPaymentForm"
, 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
"payment_form_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64 Maybe Int
payment_form_id_
, Key
"order_info_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
order_info_id_
, Key
"shipping_option_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
shipping_option_id_
, Key
"credentials" Key -> Maybe InputCredentials -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputCredentials
credentials_
, Key
"tip_amount" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
tip_amount_
]
defaultSendPaymentForm :: SendPaymentForm
defaultSendPaymentForm :: SendPaymentForm
defaultSendPaymentForm =
SendPaymentForm
{ input_invoice :: Maybe InputInvoice
input_invoice = Maybe InputInvoice
forall a. Maybe a
Nothing
, payment_form_id :: Maybe Int
payment_form_id = Maybe Int
forall a. Maybe a
Nothing
, order_info_id :: Maybe Text
order_info_id = Maybe Text
forall a. Maybe a
Nothing
, shipping_option_id :: Maybe Text
shipping_option_id = Maybe Text
forall a. Maybe a
Nothing
, credentials :: Maybe InputCredentials
credentials = Maybe InputCredentials
forall a. Maybe a
Nothing
, tip_amount :: Maybe Int
tip_amount = Maybe Int
forall a. Maybe a
Nothing
}