{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.SepaDebitGeneratedFrom 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 {-# SOURCE #-} StripeAPI.Types.Charge
import {-# SOURCE #-} StripeAPI.Types.SetupAttempt
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data SepaDebitGeneratedFrom = SepaDebitGeneratedFrom
{
SepaDebitGeneratedFrom
-> Maybe SepaDebitGeneratedFromCharge'Variants
sepaDebitGeneratedFromCharge :: (GHC.Maybe.Maybe SepaDebitGeneratedFromCharge'Variants),
SepaDebitGeneratedFrom
-> Maybe SepaDebitGeneratedFromSetupAttempt'Variants
sepaDebitGeneratedFromSetupAttempt :: (GHC.Maybe.Maybe SepaDebitGeneratedFromSetupAttempt'Variants)
}
deriving
( Int -> SepaDebitGeneratedFrom -> ShowS
[SepaDebitGeneratedFrom] -> ShowS
SepaDebitGeneratedFrom -> String
(Int -> SepaDebitGeneratedFrom -> ShowS)
-> (SepaDebitGeneratedFrom -> String)
-> ([SepaDebitGeneratedFrom] -> ShowS)
-> Show SepaDebitGeneratedFrom
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SepaDebitGeneratedFrom] -> ShowS
$cshowList :: [SepaDebitGeneratedFrom] -> ShowS
show :: SepaDebitGeneratedFrom -> String
$cshow :: SepaDebitGeneratedFrom -> String
showsPrec :: Int -> SepaDebitGeneratedFrom -> ShowS
$cshowsPrec :: Int -> SepaDebitGeneratedFrom -> ShowS
GHC.Show.Show,
SepaDebitGeneratedFrom -> SepaDebitGeneratedFrom -> Bool
(SepaDebitGeneratedFrom -> SepaDebitGeneratedFrom -> Bool)
-> (SepaDebitGeneratedFrom -> SepaDebitGeneratedFrom -> Bool)
-> Eq SepaDebitGeneratedFrom
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SepaDebitGeneratedFrom -> SepaDebitGeneratedFrom -> Bool
$c/= :: SepaDebitGeneratedFrom -> SepaDebitGeneratedFrom -> Bool
== :: SepaDebitGeneratedFrom -> SepaDebitGeneratedFrom -> Bool
$c== :: SepaDebitGeneratedFrom -> SepaDebitGeneratedFrom -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON SepaDebitGeneratedFrom where
toJSON :: SepaDebitGeneratedFrom -> Value
toJSON SepaDebitGeneratedFrom
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"charge" Text -> Maybe SepaDebitGeneratedFromCharge'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SepaDebitGeneratedFrom
-> Maybe SepaDebitGeneratedFromCharge'Variants
sepaDebitGeneratedFromCharge SepaDebitGeneratedFrom
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"setup_attempt" Text -> Maybe SepaDebitGeneratedFromSetupAttempt'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SepaDebitGeneratedFrom
-> Maybe SepaDebitGeneratedFromSetupAttempt'Variants
sepaDebitGeneratedFromSetupAttempt SepaDebitGeneratedFrom
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: SepaDebitGeneratedFrom -> Encoding
toEncoding SepaDebitGeneratedFrom
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"charge" Text -> Maybe SepaDebitGeneratedFromCharge'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SepaDebitGeneratedFrom
-> Maybe SepaDebitGeneratedFromCharge'Variants
sepaDebitGeneratedFromCharge SepaDebitGeneratedFrom
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"setup_attempt" Text -> Maybe SepaDebitGeneratedFromSetupAttempt'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SepaDebitGeneratedFrom
-> Maybe SepaDebitGeneratedFromSetupAttempt'Variants
sepaDebitGeneratedFromSetupAttempt SepaDebitGeneratedFrom
obj))
instance Data.Aeson.Types.FromJSON.FromJSON SepaDebitGeneratedFrom where
parseJSON :: Value -> Parser SepaDebitGeneratedFrom
parseJSON = String
-> (Object -> Parser SepaDebitGeneratedFrom)
-> Value
-> Parser SepaDebitGeneratedFrom
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"SepaDebitGeneratedFrom" (\Object
obj -> ((Maybe SepaDebitGeneratedFromCharge'Variants
-> Maybe SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFrom)
-> Parser
(Maybe SepaDebitGeneratedFromCharge'Variants
-> Maybe SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFrom)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe SepaDebitGeneratedFromCharge'Variants
-> Maybe SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFrom
SepaDebitGeneratedFrom Parser
(Maybe SepaDebitGeneratedFromCharge'Variants
-> Maybe SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFrom)
-> Parser (Maybe SepaDebitGeneratedFromCharge'Variants)
-> Parser
(Maybe SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFrom)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe SepaDebitGeneratedFromCharge'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"charge")) Parser
(Maybe SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFrom)
-> Parser (Maybe SepaDebitGeneratedFromSetupAttempt'Variants)
-> Parser SepaDebitGeneratedFrom
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe SepaDebitGeneratedFromSetupAttempt'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"setup_attempt"))
mkSepaDebitGeneratedFrom :: SepaDebitGeneratedFrom
mkSepaDebitGeneratedFrom :: SepaDebitGeneratedFrom
mkSepaDebitGeneratedFrom =
SepaDebitGeneratedFrom :: Maybe SepaDebitGeneratedFromCharge'Variants
-> Maybe SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFrom
SepaDebitGeneratedFrom
{ sepaDebitGeneratedFromCharge :: Maybe SepaDebitGeneratedFromCharge'Variants
sepaDebitGeneratedFromCharge = Maybe SepaDebitGeneratedFromCharge'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
sepaDebitGeneratedFromSetupAttempt :: Maybe SepaDebitGeneratedFromSetupAttempt'Variants
sepaDebitGeneratedFromSetupAttempt = Maybe SepaDebitGeneratedFromSetupAttempt'Variants
forall a. Maybe a
GHC.Maybe.Nothing
}
data SepaDebitGeneratedFromCharge'Variants
= SepaDebitGeneratedFromCharge'Text Data.Text.Internal.Text
| SepaDebitGeneratedFromCharge'Charge Charge
deriving (Int -> SepaDebitGeneratedFromCharge'Variants -> ShowS
[SepaDebitGeneratedFromCharge'Variants] -> ShowS
SepaDebitGeneratedFromCharge'Variants -> String
(Int -> SepaDebitGeneratedFromCharge'Variants -> ShowS)
-> (SepaDebitGeneratedFromCharge'Variants -> String)
-> ([SepaDebitGeneratedFromCharge'Variants] -> ShowS)
-> Show SepaDebitGeneratedFromCharge'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SepaDebitGeneratedFromCharge'Variants] -> ShowS
$cshowList :: [SepaDebitGeneratedFromCharge'Variants] -> ShowS
show :: SepaDebitGeneratedFromCharge'Variants -> String
$cshow :: SepaDebitGeneratedFromCharge'Variants -> String
showsPrec :: Int -> SepaDebitGeneratedFromCharge'Variants -> ShowS
$cshowsPrec :: Int -> SepaDebitGeneratedFromCharge'Variants -> ShowS
GHC.Show.Show, SepaDebitGeneratedFromCharge'Variants
-> SepaDebitGeneratedFromCharge'Variants -> Bool
(SepaDebitGeneratedFromCharge'Variants
-> SepaDebitGeneratedFromCharge'Variants -> Bool)
-> (SepaDebitGeneratedFromCharge'Variants
-> SepaDebitGeneratedFromCharge'Variants -> Bool)
-> Eq SepaDebitGeneratedFromCharge'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SepaDebitGeneratedFromCharge'Variants
-> SepaDebitGeneratedFromCharge'Variants -> Bool
$c/= :: SepaDebitGeneratedFromCharge'Variants
-> SepaDebitGeneratedFromCharge'Variants -> Bool
== :: SepaDebitGeneratedFromCharge'Variants
-> SepaDebitGeneratedFromCharge'Variants -> Bool
$c== :: SepaDebitGeneratedFromCharge'Variants
-> SepaDebitGeneratedFromCharge'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON SepaDebitGeneratedFromCharge'Variants where
toJSON :: SepaDebitGeneratedFromCharge'Variants -> Value
toJSON (SepaDebitGeneratedFromCharge'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
toJSON (SepaDebitGeneratedFromCharge'Charge Charge
a) = Charge -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Charge
a
instance Data.Aeson.Types.FromJSON.FromJSON SepaDebitGeneratedFromCharge'Variants where
parseJSON :: Value -> Parser SepaDebitGeneratedFromCharge'Variants
parseJSON Value
val = case (Text -> SepaDebitGeneratedFromCharge'Variants
SepaDebitGeneratedFromCharge'Text (Text -> SepaDebitGeneratedFromCharge'Variants)
-> Result Text -> Result SepaDebitGeneratedFromCharge'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result SepaDebitGeneratedFromCharge'Variants
-> Result SepaDebitGeneratedFromCharge'Variants
-> Result SepaDebitGeneratedFromCharge'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Charge -> SepaDebitGeneratedFromCharge'Variants
SepaDebitGeneratedFromCharge'Charge (Charge -> SepaDebitGeneratedFromCharge'Variants)
-> Result Charge -> Result SepaDebitGeneratedFromCharge'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Charge
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result SepaDebitGeneratedFromCharge'Variants
-> Result SepaDebitGeneratedFromCharge'Variants
-> Result SepaDebitGeneratedFromCharge'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result SepaDebitGeneratedFromCharge'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
Data.Aeson.Types.Internal.Success SepaDebitGeneratedFromCharge'Variants
a -> SepaDebitGeneratedFromCharge'Variants
-> Parser SepaDebitGeneratedFromCharge'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure SepaDebitGeneratedFromCharge'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String -> Parser SepaDebitGeneratedFromCharge'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a
data SepaDebitGeneratedFromSetupAttempt'Variants
= SepaDebitGeneratedFromSetupAttempt'Text Data.Text.Internal.Text
| SepaDebitGeneratedFromSetupAttempt'SetupAttempt SetupAttempt
deriving (Int -> SepaDebitGeneratedFromSetupAttempt'Variants -> ShowS
[SepaDebitGeneratedFromSetupAttempt'Variants] -> ShowS
SepaDebitGeneratedFromSetupAttempt'Variants -> String
(Int -> SepaDebitGeneratedFromSetupAttempt'Variants -> ShowS)
-> (SepaDebitGeneratedFromSetupAttempt'Variants -> String)
-> ([SepaDebitGeneratedFromSetupAttempt'Variants] -> ShowS)
-> Show SepaDebitGeneratedFromSetupAttempt'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SepaDebitGeneratedFromSetupAttempt'Variants] -> ShowS
$cshowList :: [SepaDebitGeneratedFromSetupAttempt'Variants] -> ShowS
show :: SepaDebitGeneratedFromSetupAttempt'Variants -> String
$cshow :: SepaDebitGeneratedFromSetupAttempt'Variants -> String
showsPrec :: Int -> SepaDebitGeneratedFromSetupAttempt'Variants -> ShowS
$cshowsPrec :: Int -> SepaDebitGeneratedFromSetupAttempt'Variants -> ShowS
GHC.Show.Show, SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFromSetupAttempt'Variants -> Bool
(SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFromSetupAttempt'Variants -> Bool)
-> (SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFromSetupAttempt'Variants -> Bool)
-> Eq SepaDebitGeneratedFromSetupAttempt'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFromSetupAttempt'Variants -> Bool
$c/= :: SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFromSetupAttempt'Variants -> Bool
== :: SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFromSetupAttempt'Variants -> Bool
$c== :: SepaDebitGeneratedFromSetupAttempt'Variants
-> SepaDebitGeneratedFromSetupAttempt'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON SepaDebitGeneratedFromSetupAttempt'Variants where
toJSON :: SepaDebitGeneratedFromSetupAttempt'Variants -> Value
toJSON (SepaDebitGeneratedFromSetupAttempt'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
toJSON (SepaDebitGeneratedFromSetupAttempt'SetupAttempt SetupAttempt
a) = SetupAttempt -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON SetupAttempt
a
instance Data.Aeson.Types.FromJSON.FromJSON SepaDebitGeneratedFromSetupAttempt'Variants where
parseJSON :: Value -> Parser SepaDebitGeneratedFromSetupAttempt'Variants
parseJSON Value
val = case (Text -> SepaDebitGeneratedFromSetupAttempt'Variants
SepaDebitGeneratedFromSetupAttempt'Text (Text -> SepaDebitGeneratedFromSetupAttempt'Variants)
-> Result Text
-> Result SepaDebitGeneratedFromSetupAttempt'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result SepaDebitGeneratedFromSetupAttempt'Variants
-> Result SepaDebitGeneratedFromSetupAttempt'Variants
-> Result SepaDebitGeneratedFromSetupAttempt'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((SetupAttempt -> SepaDebitGeneratedFromSetupAttempt'Variants
SepaDebitGeneratedFromSetupAttempt'SetupAttempt (SetupAttempt -> SepaDebitGeneratedFromSetupAttempt'Variants)
-> Result SetupAttempt
-> Result SepaDebitGeneratedFromSetupAttempt'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result SetupAttempt
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result SepaDebitGeneratedFromSetupAttempt'Variants
-> Result SepaDebitGeneratedFromSetupAttempt'Variants
-> Result SepaDebitGeneratedFromSetupAttempt'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result SepaDebitGeneratedFromSetupAttempt'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
Data.Aeson.Types.Internal.Success SepaDebitGeneratedFromSetupAttempt'Variants
a -> SepaDebitGeneratedFromSetupAttempt'Variants
-> Parser SepaDebitGeneratedFromSetupAttempt'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure SepaDebitGeneratedFromSetupAttempt'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String -> Parser SepaDebitGeneratedFromSetupAttempt'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a