{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.InvoicePaymentMethodOptionsCard where
import qualified Control.Monad.Fail
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Encoding.Internal
import qualified Data.Aeson as Data.Aeson.Types
import qualified Data.Aeson as Data.Aeson.Types.FromJSON
import qualified Data.Aeson as Data.Aeson.Types.Internal
import qualified Data.Aeson as Data.Aeson.Types.ToJSON
import qualified Data.ByteString.Char8
import qualified Data.ByteString.Char8 as Data.ByteString.Internal
import qualified Data.Functor
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text.Internal
import qualified Data.Time.Calendar as Data.Time.Calendar.Days
import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified StripeAPI.Common
import StripeAPI.TypeAlias
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data InvoicePaymentMethodOptionsCard = InvoicePaymentMethodOptionsCard
{
InvoicePaymentMethodOptionsCard
-> Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
invoicePaymentMethodOptionsCardRequestThreeDSecure :: (GHC.Maybe.Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure')
}
deriving
( Int -> InvoicePaymentMethodOptionsCard -> ShowS
[InvoicePaymentMethodOptionsCard] -> ShowS
InvoicePaymentMethodOptionsCard -> String
(Int -> InvoicePaymentMethodOptionsCard -> ShowS)
-> (InvoicePaymentMethodOptionsCard -> String)
-> ([InvoicePaymentMethodOptionsCard] -> ShowS)
-> Show InvoicePaymentMethodOptionsCard
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoicePaymentMethodOptionsCard] -> ShowS
$cshowList :: [InvoicePaymentMethodOptionsCard] -> ShowS
show :: InvoicePaymentMethodOptionsCard -> String
$cshow :: InvoicePaymentMethodOptionsCard -> String
showsPrec :: Int -> InvoicePaymentMethodOptionsCard -> ShowS
$cshowsPrec :: Int -> InvoicePaymentMethodOptionsCard -> ShowS
GHC.Show.Show,
InvoicePaymentMethodOptionsCard
-> InvoicePaymentMethodOptionsCard -> Bool
(InvoicePaymentMethodOptionsCard
-> InvoicePaymentMethodOptionsCard -> Bool)
-> (InvoicePaymentMethodOptionsCard
-> InvoicePaymentMethodOptionsCard -> Bool)
-> Eq InvoicePaymentMethodOptionsCard
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoicePaymentMethodOptionsCard
-> InvoicePaymentMethodOptionsCard -> Bool
$c/= :: InvoicePaymentMethodOptionsCard
-> InvoicePaymentMethodOptionsCard -> Bool
== :: InvoicePaymentMethodOptionsCard
-> InvoicePaymentMethodOptionsCard -> Bool
$c== :: InvoicePaymentMethodOptionsCard
-> InvoicePaymentMethodOptionsCard -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON InvoicePaymentMethodOptionsCard where
toJSON :: InvoicePaymentMethodOptionsCard -> Value
toJSON InvoicePaymentMethodOptionsCard
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"request_three_d_secure" Text
-> Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoicePaymentMethodOptionsCard
-> Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
invoicePaymentMethodOptionsCardRequestThreeDSecure InvoicePaymentMethodOptionsCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: InvoicePaymentMethodOptionsCard -> Encoding
toEncoding InvoicePaymentMethodOptionsCard
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs (Text
"request_three_d_secure" Text
-> Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoicePaymentMethodOptionsCard
-> Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
invoicePaymentMethodOptionsCardRequestThreeDSecure InvoicePaymentMethodOptionsCard
obj)
instance Data.Aeson.Types.FromJSON.FromJSON InvoicePaymentMethodOptionsCard where
parseJSON :: Value -> Parser InvoicePaymentMethodOptionsCard
parseJSON = String
-> (Object -> Parser InvoicePaymentMethodOptionsCard)
-> Value
-> Parser InvoicePaymentMethodOptionsCard
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"InvoicePaymentMethodOptionsCard" (\Object
obj -> (Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCard)
-> Parser
(Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCard)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCard
InvoicePaymentMethodOptionsCard Parser
(Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCard)
-> Parser
(Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure')
-> Parser InvoicePaymentMethodOptionsCard
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
(Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"request_three_d_secure"))
mkInvoicePaymentMethodOptionsCard :: InvoicePaymentMethodOptionsCard
mkInvoicePaymentMethodOptionsCard :: InvoicePaymentMethodOptionsCard
mkInvoicePaymentMethodOptionsCard = InvoicePaymentMethodOptionsCard :: Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCard
InvoicePaymentMethodOptionsCard {invoicePaymentMethodOptionsCardRequestThreeDSecure :: Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
invoicePaymentMethodOptionsCardRequestThreeDSecure = Maybe InvoicePaymentMethodOptionsCardRequestThreeDSecure'
forall a. Maybe a
GHC.Maybe.Nothing}
data InvoicePaymentMethodOptionsCardRequestThreeDSecure'
=
InvoicePaymentMethodOptionsCardRequestThreeDSecure'Other Data.Aeson.Types.Internal.Value
|
InvoicePaymentMethodOptionsCardRequestThreeDSecure'Typed Data.Text.Internal.Text
|
InvoicePaymentMethodOptionsCardRequestThreeDSecure'EnumAny
|
InvoicePaymentMethodOptionsCardRequestThreeDSecure'EnumAutomatic
deriving (Int -> InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> ShowS
[InvoicePaymentMethodOptionsCardRequestThreeDSecure'] -> ShowS
InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> String
(Int
-> InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> ShowS)
-> (InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> String)
-> ([InvoicePaymentMethodOptionsCardRequestThreeDSecure'] -> ShowS)
-> Show InvoicePaymentMethodOptionsCardRequestThreeDSecure'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoicePaymentMethodOptionsCardRequestThreeDSecure'] -> ShowS
$cshowList :: [InvoicePaymentMethodOptionsCardRequestThreeDSecure'] -> ShowS
show :: InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> String
$cshow :: InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> String
showsPrec :: Int -> InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> ShowS
$cshowsPrec :: Int -> InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> ShowS
GHC.Show.Show, InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> Bool
(InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> Bool)
-> (InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> Bool)
-> Eq InvoicePaymentMethodOptionsCardRequestThreeDSecure'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> Bool
$c/= :: InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> Bool
== :: InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> Bool
$c== :: InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON InvoicePaymentMethodOptionsCardRequestThreeDSecure' where
toJSON :: InvoicePaymentMethodOptionsCardRequestThreeDSecure' -> Value
toJSON (InvoicePaymentMethodOptionsCardRequestThreeDSecure'Other Value
val) = Value
val
toJSON (InvoicePaymentMethodOptionsCardRequestThreeDSecure'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (InvoicePaymentMethodOptionsCardRequestThreeDSecure'
InvoicePaymentMethodOptionsCardRequestThreeDSecure'EnumAny) = Value
"any"
toJSON (InvoicePaymentMethodOptionsCardRequestThreeDSecure'
InvoicePaymentMethodOptionsCardRequestThreeDSecure'EnumAutomatic) = Value
"automatic"
instance Data.Aeson.Types.FromJSON.FromJSON InvoicePaymentMethodOptionsCardRequestThreeDSecure' where
parseJSON :: Value -> Parser InvoicePaymentMethodOptionsCardRequestThreeDSecure'
parseJSON Value
val =
InvoicePaymentMethodOptionsCardRequestThreeDSecure'
-> Parser InvoicePaymentMethodOptionsCardRequestThreeDSecure'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"any" -> InvoicePaymentMethodOptionsCardRequestThreeDSecure'
InvoicePaymentMethodOptionsCardRequestThreeDSecure'EnumAny
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"automatic" -> InvoicePaymentMethodOptionsCardRequestThreeDSecure'
InvoicePaymentMethodOptionsCardRequestThreeDSecure'EnumAutomatic
| Bool
GHC.Base.otherwise -> Value -> InvoicePaymentMethodOptionsCardRequestThreeDSecure'
InvoicePaymentMethodOptionsCardRequestThreeDSecure'Other Value
val
)