{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.SetupIntentPaymentMethodOptionsCard 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 SetupIntentPaymentMethodOptionsCard = SetupIntentPaymentMethodOptionsCard
{
SetupIntentPaymentMethodOptionsCard
-> Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
setupIntentPaymentMethodOptionsCardRequestThreeDSecure :: (GHC.Maybe.Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure')
}
deriving
( Int -> SetupIntentPaymentMethodOptionsCard -> ShowS
[SetupIntentPaymentMethodOptionsCard] -> ShowS
SetupIntentPaymentMethodOptionsCard -> String
(Int -> SetupIntentPaymentMethodOptionsCard -> ShowS)
-> (SetupIntentPaymentMethodOptionsCard -> String)
-> ([SetupIntentPaymentMethodOptionsCard] -> ShowS)
-> Show SetupIntentPaymentMethodOptionsCard
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetupIntentPaymentMethodOptionsCard] -> ShowS
$cshowList :: [SetupIntentPaymentMethodOptionsCard] -> ShowS
show :: SetupIntentPaymentMethodOptionsCard -> String
$cshow :: SetupIntentPaymentMethodOptionsCard -> String
showsPrec :: Int -> SetupIntentPaymentMethodOptionsCard -> ShowS
$cshowsPrec :: Int -> SetupIntentPaymentMethodOptionsCard -> ShowS
GHC.Show.Show,
SetupIntentPaymentMethodOptionsCard
-> SetupIntentPaymentMethodOptionsCard -> Bool
(SetupIntentPaymentMethodOptionsCard
-> SetupIntentPaymentMethodOptionsCard -> Bool)
-> (SetupIntentPaymentMethodOptionsCard
-> SetupIntentPaymentMethodOptionsCard -> Bool)
-> Eq SetupIntentPaymentMethodOptionsCard
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetupIntentPaymentMethodOptionsCard
-> SetupIntentPaymentMethodOptionsCard -> Bool
$c/= :: SetupIntentPaymentMethodOptionsCard
-> SetupIntentPaymentMethodOptionsCard -> Bool
== :: SetupIntentPaymentMethodOptionsCard
-> SetupIntentPaymentMethodOptionsCard -> Bool
$c== :: SetupIntentPaymentMethodOptionsCard
-> SetupIntentPaymentMethodOptionsCard -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON SetupIntentPaymentMethodOptionsCard where
toJSON :: SetupIntentPaymentMethodOptionsCard -> Value
toJSON SetupIntentPaymentMethodOptionsCard
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"request_three_d_secure" Text
-> Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SetupIntentPaymentMethodOptionsCard
-> Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
setupIntentPaymentMethodOptionsCardRequestThreeDSecure SetupIntentPaymentMethodOptionsCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: SetupIntentPaymentMethodOptionsCard -> Encoding
toEncoding SetupIntentPaymentMethodOptionsCard
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs (Text
"request_three_d_secure" Text
-> Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SetupIntentPaymentMethodOptionsCard
-> Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
setupIntentPaymentMethodOptionsCardRequestThreeDSecure SetupIntentPaymentMethodOptionsCard
obj)
instance Data.Aeson.Types.FromJSON.FromJSON SetupIntentPaymentMethodOptionsCard where
parseJSON :: Value -> Parser SetupIntentPaymentMethodOptionsCard
parseJSON = String
-> (Object -> Parser SetupIntentPaymentMethodOptionsCard)
-> Value
-> Parser SetupIntentPaymentMethodOptionsCard
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"SetupIntentPaymentMethodOptionsCard" (\Object
obj -> (Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCard)
-> Parser
(Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCard)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCard
SetupIntentPaymentMethodOptionsCard Parser
(Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCard)
-> Parser
(Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure')
-> Parser SetupIntentPaymentMethodOptionsCard
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
(Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"request_three_d_secure"))
mkSetupIntentPaymentMethodOptionsCard :: SetupIntentPaymentMethodOptionsCard
mkSetupIntentPaymentMethodOptionsCard :: SetupIntentPaymentMethodOptionsCard
mkSetupIntentPaymentMethodOptionsCard = SetupIntentPaymentMethodOptionsCard :: Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCard
SetupIntentPaymentMethodOptionsCard {setupIntentPaymentMethodOptionsCardRequestThreeDSecure :: Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
setupIntentPaymentMethodOptionsCardRequestThreeDSecure = Maybe SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
forall a. Maybe a
GHC.Maybe.Nothing}
data SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
=
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'Other Data.Aeson.Types.Internal.Value
|
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'Typed Data.Text.Internal.Text
|
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'EnumAny
|
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'EnumAutomatic
|
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'EnumChallengeOnly
deriving (Int
-> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> ShowS
[SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'] -> ShowS
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> String
(Int
-> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> ShowS)
-> (SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> String)
-> ([SetupIntentPaymentMethodOptionsCardRequestThreeDSecure']
-> ShowS)
-> Show SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'] -> ShowS
$cshowList :: [SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'] -> ShowS
show :: SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> String
$cshow :: SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> String
showsPrec :: Int
-> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> ShowS
$cshowsPrec :: Int
-> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> ShowS
GHC.Show.Show, SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> Bool
(SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> Bool)
-> (SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> Bool)
-> Eq SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> Bool
$c/= :: SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> Bool
== :: SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> Bool
$c== :: SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' where
toJSON :: SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' -> Value
toJSON (SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'Other Value
val) = Value
val
toJSON (SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'EnumAny) = Value
"any"
toJSON (SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'EnumAutomatic) = Value
"automatic"
toJSON (SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'EnumChallengeOnly) = Value
"challenge_only"
instance Data.Aeson.Types.FromJSON.FromJSON SetupIntentPaymentMethodOptionsCardRequestThreeDSecure' where
parseJSON :: Value
-> Parser SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
parseJSON Value
val =
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
-> Parser SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
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" -> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'EnumAny
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"automatic" -> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'EnumAutomatic
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"challenge_only" -> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'EnumChallengeOnly
| Bool
GHC.Base.otherwise -> Value -> SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'
SetupIntentPaymentMethodOptionsCardRequestThreeDSecure'Other Value
val
)