{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.MandateBacsDebit 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 MandateBacsDebit = MandateBacsDebit
{
MandateBacsDebit -> MandateBacsDebitNetworkStatus'
mandateBacsDebitNetworkStatus :: MandateBacsDebitNetworkStatus',
MandateBacsDebit -> Text
mandateBacsDebitReference :: Data.Text.Internal.Text,
MandateBacsDebit -> Text
mandateBacsDebitUrl :: Data.Text.Internal.Text
}
deriving
( Int -> MandateBacsDebit -> ShowS
[MandateBacsDebit] -> ShowS
MandateBacsDebit -> String
(Int -> MandateBacsDebit -> ShowS)
-> (MandateBacsDebit -> String)
-> ([MandateBacsDebit] -> ShowS)
-> Show MandateBacsDebit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MandateBacsDebit] -> ShowS
$cshowList :: [MandateBacsDebit] -> ShowS
show :: MandateBacsDebit -> String
$cshow :: MandateBacsDebit -> String
showsPrec :: Int -> MandateBacsDebit -> ShowS
$cshowsPrec :: Int -> MandateBacsDebit -> ShowS
GHC.Show.Show,
MandateBacsDebit -> MandateBacsDebit -> Bool
(MandateBacsDebit -> MandateBacsDebit -> Bool)
-> (MandateBacsDebit -> MandateBacsDebit -> Bool)
-> Eq MandateBacsDebit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MandateBacsDebit -> MandateBacsDebit -> Bool
$c/= :: MandateBacsDebit -> MandateBacsDebit -> Bool
== :: MandateBacsDebit -> MandateBacsDebit -> Bool
$c== :: MandateBacsDebit -> MandateBacsDebit -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON MandateBacsDebit where
toJSON :: MandateBacsDebit -> Value
toJSON MandateBacsDebit
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"network_status" Text -> MandateBacsDebitNetworkStatus' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateBacsDebit -> MandateBacsDebitNetworkStatus'
mandateBacsDebitNetworkStatus MandateBacsDebit
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"reference" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateBacsDebit -> Text
mandateBacsDebitReference MandateBacsDebit
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateBacsDebit -> Text
mandateBacsDebitUrl MandateBacsDebit
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: MandateBacsDebit -> Encoding
toEncoding MandateBacsDebit
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"network_status" Text -> MandateBacsDebitNetworkStatus' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateBacsDebit -> MandateBacsDebitNetworkStatus'
mandateBacsDebitNetworkStatus MandateBacsDebit
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"reference" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateBacsDebit -> Text
mandateBacsDebitReference MandateBacsDebit
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"url" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateBacsDebit -> Text
mandateBacsDebitUrl MandateBacsDebit
obj)))
instance Data.Aeson.Types.FromJSON.FromJSON MandateBacsDebit where
parseJSON :: Value -> Parser MandateBacsDebit
parseJSON = String
-> (Object -> Parser MandateBacsDebit)
-> Value
-> Parser MandateBacsDebit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"MandateBacsDebit" (\Object
obj -> (((MandateBacsDebitNetworkStatus'
-> Text -> Text -> MandateBacsDebit)
-> Parser
(MandateBacsDebitNetworkStatus'
-> Text -> Text -> MandateBacsDebit)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure MandateBacsDebitNetworkStatus' -> Text -> Text -> MandateBacsDebit
MandateBacsDebit Parser
(MandateBacsDebitNetworkStatus'
-> Text -> Text -> MandateBacsDebit)
-> Parser MandateBacsDebitNetworkStatus'
-> Parser (Text -> Text -> MandateBacsDebit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser MandateBacsDebitNetworkStatus'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"network_status")) Parser (Text -> Text -> MandateBacsDebit)
-> Parser Text -> Parser (Text -> MandateBacsDebit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"reference")) Parser (Text -> MandateBacsDebit)
-> Parser Text -> Parser MandateBacsDebit
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"url"))
mkMandateBacsDebit ::
MandateBacsDebitNetworkStatus' ->
Data.Text.Internal.Text ->
Data.Text.Internal.Text ->
MandateBacsDebit
mkMandateBacsDebit :: MandateBacsDebitNetworkStatus' -> Text -> Text -> MandateBacsDebit
mkMandateBacsDebit MandateBacsDebitNetworkStatus'
mandateBacsDebitNetworkStatus Text
mandateBacsDebitReference Text
mandateBacsDebitUrl =
MandateBacsDebit :: MandateBacsDebitNetworkStatus' -> Text -> Text -> MandateBacsDebit
MandateBacsDebit
{ mandateBacsDebitNetworkStatus :: MandateBacsDebitNetworkStatus'
mandateBacsDebitNetworkStatus = MandateBacsDebitNetworkStatus'
mandateBacsDebitNetworkStatus,
mandateBacsDebitReference :: Text
mandateBacsDebitReference = Text
mandateBacsDebitReference,
mandateBacsDebitUrl :: Text
mandateBacsDebitUrl = Text
mandateBacsDebitUrl
}
data MandateBacsDebitNetworkStatus'
=
MandateBacsDebitNetworkStatus'Other Data.Aeson.Types.Internal.Value
|
MandateBacsDebitNetworkStatus'Typed Data.Text.Internal.Text
|
MandateBacsDebitNetworkStatus'EnumAccepted
|
MandateBacsDebitNetworkStatus'EnumPending
|
MandateBacsDebitNetworkStatus'EnumRefused
|
MandateBacsDebitNetworkStatus'EnumRevoked
deriving (Int -> MandateBacsDebitNetworkStatus' -> ShowS
[MandateBacsDebitNetworkStatus'] -> ShowS
MandateBacsDebitNetworkStatus' -> String
(Int -> MandateBacsDebitNetworkStatus' -> ShowS)
-> (MandateBacsDebitNetworkStatus' -> String)
-> ([MandateBacsDebitNetworkStatus'] -> ShowS)
-> Show MandateBacsDebitNetworkStatus'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MandateBacsDebitNetworkStatus'] -> ShowS
$cshowList :: [MandateBacsDebitNetworkStatus'] -> ShowS
show :: MandateBacsDebitNetworkStatus' -> String
$cshow :: MandateBacsDebitNetworkStatus' -> String
showsPrec :: Int -> MandateBacsDebitNetworkStatus' -> ShowS
$cshowsPrec :: Int -> MandateBacsDebitNetworkStatus' -> ShowS
GHC.Show.Show, MandateBacsDebitNetworkStatus'
-> MandateBacsDebitNetworkStatus' -> Bool
(MandateBacsDebitNetworkStatus'
-> MandateBacsDebitNetworkStatus' -> Bool)
-> (MandateBacsDebitNetworkStatus'
-> MandateBacsDebitNetworkStatus' -> Bool)
-> Eq MandateBacsDebitNetworkStatus'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MandateBacsDebitNetworkStatus'
-> MandateBacsDebitNetworkStatus' -> Bool
$c/= :: MandateBacsDebitNetworkStatus'
-> MandateBacsDebitNetworkStatus' -> Bool
== :: MandateBacsDebitNetworkStatus'
-> MandateBacsDebitNetworkStatus' -> Bool
$c== :: MandateBacsDebitNetworkStatus'
-> MandateBacsDebitNetworkStatus' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON MandateBacsDebitNetworkStatus' where
toJSON :: MandateBacsDebitNetworkStatus' -> Value
toJSON (MandateBacsDebitNetworkStatus'Other Value
val) = Value
val
toJSON (MandateBacsDebitNetworkStatus'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (MandateBacsDebitNetworkStatus'
MandateBacsDebitNetworkStatus'EnumAccepted) = Value
"accepted"
toJSON (MandateBacsDebitNetworkStatus'
MandateBacsDebitNetworkStatus'EnumPending) = Value
"pending"
toJSON (MandateBacsDebitNetworkStatus'
MandateBacsDebitNetworkStatus'EnumRefused) = Value
"refused"
toJSON (MandateBacsDebitNetworkStatus'
MandateBacsDebitNetworkStatus'EnumRevoked) = Value
"revoked"
instance Data.Aeson.Types.FromJSON.FromJSON MandateBacsDebitNetworkStatus' where
parseJSON :: Value -> Parser MandateBacsDebitNetworkStatus'
parseJSON Value
val =
MandateBacsDebitNetworkStatus'
-> Parser MandateBacsDebitNetworkStatus'
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
"accepted" -> MandateBacsDebitNetworkStatus'
MandateBacsDebitNetworkStatus'EnumAccepted
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"pending" -> MandateBacsDebitNetworkStatus'
MandateBacsDebitNetworkStatus'EnumPending
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"refused" -> MandateBacsDebitNetworkStatus'
MandateBacsDebitNetworkStatus'EnumRefused
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"revoked" -> MandateBacsDebitNetworkStatus'
MandateBacsDebitNetworkStatus'EnumRevoked
| Bool
GHC.Base.otherwise -> Value -> MandateBacsDebitNetworkStatus'
MandateBacsDebitNetworkStatus'Other Value
val
)