{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.MandateAcssDebit 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 MandateAcssDebit = MandateAcssDebit
{
MandateAcssDebit -> Maybe Text
mandateAcssDebitIntervalDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
MandateAcssDebit -> MandateAcssDebitPaymentSchedule'
mandateAcssDebitPaymentSchedule :: MandateAcssDebitPaymentSchedule',
MandateAcssDebit -> MandateAcssDebitTransactionType'
mandateAcssDebitTransactionType :: MandateAcssDebitTransactionType'
}
deriving
( Int -> MandateAcssDebit -> ShowS
[MandateAcssDebit] -> ShowS
MandateAcssDebit -> String
(Int -> MandateAcssDebit -> ShowS)
-> (MandateAcssDebit -> String)
-> ([MandateAcssDebit] -> ShowS)
-> Show MandateAcssDebit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MandateAcssDebit] -> ShowS
$cshowList :: [MandateAcssDebit] -> ShowS
show :: MandateAcssDebit -> String
$cshow :: MandateAcssDebit -> String
showsPrec :: Int -> MandateAcssDebit -> ShowS
$cshowsPrec :: Int -> MandateAcssDebit -> ShowS
GHC.Show.Show,
MandateAcssDebit -> MandateAcssDebit -> Bool
(MandateAcssDebit -> MandateAcssDebit -> Bool)
-> (MandateAcssDebit -> MandateAcssDebit -> Bool)
-> Eq MandateAcssDebit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MandateAcssDebit -> MandateAcssDebit -> Bool
$c/= :: MandateAcssDebit -> MandateAcssDebit -> Bool
== :: MandateAcssDebit -> MandateAcssDebit -> Bool
$c== :: MandateAcssDebit -> MandateAcssDebit -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON MandateAcssDebit where
toJSON :: MandateAcssDebit -> Value
toJSON MandateAcssDebit
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"interval_description" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateAcssDebit -> Maybe Text
mandateAcssDebitIntervalDescription MandateAcssDebit
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"payment_schedule" Text -> MandateAcssDebitPaymentSchedule' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateAcssDebit -> MandateAcssDebitPaymentSchedule'
mandateAcssDebitPaymentSchedule MandateAcssDebit
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"transaction_type" Text -> MandateAcssDebitTransactionType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateAcssDebit -> MandateAcssDebitTransactionType'
mandateAcssDebitTransactionType MandateAcssDebit
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: MandateAcssDebit -> Encoding
toEncoding MandateAcssDebit
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"interval_description" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateAcssDebit -> Maybe Text
mandateAcssDebitIntervalDescription MandateAcssDebit
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"payment_schedule" Text -> MandateAcssDebitPaymentSchedule' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateAcssDebit -> MandateAcssDebitPaymentSchedule'
mandateAcssDebitPaymentSchedule MandateAcssDebit
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"transaction_type" Text -> MandateAcssDebitTransactionType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= MandateAcssDebit -> MandateAcssDebitTransactionType'
mandateAcssDebitTransactionType MandateAcssDebit
obj)))
instance Data.Aeson.Types.FromJSON.FromJSON MandateAcssDebit where
parseJSON :: Value -> Parser MandateAcssDebit
parseJSON = String
-> (Object -> Parser MandateAcssDebit)
-> Value
-> Parser MandateAcssDebit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"MandateAcssDebit" (\Object
obj -> (((Maybe Text
-> MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitTransactionType'
-> MandateAcssDebit)
-> Parser
(Maybe Text
-> MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitTransactionType'
-> MandateAcssDebit)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitTransactionType'
-> MandateAcssDebit
MandateAcssDebit Parser
(Maybe Text
-> MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitTransactionType'
-> MandateAcssDebit)
-> Parser (Maybe Text)
-> Parser
(MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitTransactionType' -> MandateAcssDebit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"interval_description")) Parser
(MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitTransactionType' -> MandateAcssDebit)
-> Parser MandateAcssDebitPaymentSchedule'
-> Parser (MandateAcssDebitTransactionType' -> MandateAcssDebit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser MandateAcssDebitPaymentSchedule'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"payment_schedule")) Parser (MandateAcssDebitTransactionType' -> MandateAcssDebit)
-> Parser MandateAcssDebitTransactionType'
-> Parser MandateAcssDebit
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser MandateAcssDebitTransactionType'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"transaction_type"))
mkMandateAcssDebit ::
MandateAcssDebitPaymentSchedule' ->
MandateAcssDebitTransactionType' ->
MandateAcssDebit
mkMandateAcssDebit :: MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitTransactionType' -> MandateAcssDebit
mkMandateAcssDebit MandateAcssDebitPaymentSchedule'
mandateAcssDebitPaymentSchedule MandateAcssDebitTransactionType'
mandateAcssDebitTransactionType =
MandateAcssDebit :: Maybe Text
-> MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitTransactionType'
-> MandateAcssDebit
MandateAcssDebit
{ mandateAcssDebitIntervalDescription :: Maybe Text
mandateAcssDebitIntervalDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
mandateAcssDebitPaymentSchedule :: MandateAcssDebitPaymentSchedule'
mandateAcssDebitPaymentSchedule = MandateAcssDebitPaymentSchedule'
mandateAcssDebitPaymentSchedule,
mandateAcssDebitTransactionType :: MandateAcssDebitTransactionType'
mandateAcssDebitTransactionType = MandateAcssDebitTransactionType'
mandateAcssDebitTransactionType
}
data MandateAcssDebitPaymentSchedule'
=
MandateAcssDebitPaymentSchedule'Other Data.Aeson.Types.Internal.Value
|
MandateAcssDebitPaymentSchedule'Typed Data.Text.Internal.Text
|
MandateAcssDebitPaymentSchedule'EnumCombined
|
MandateAcssDebitPaymentSchedule'EnumInterval
|
MandateAcssDebitPaymentSchedule'EnumSporadic
deriving (Int -> MandateAcssDebitPaymentSchedule' -> ShowS
[MandateAcssDebitPaymentSchedule'] -> ShowS
MandateAcssDebitPaymentSchedule' -> String
(Int -> MandateAcssDebitPaymentSchedule' -> ShowS)
-> (MandateAcssDebitPaymentSchedule' -> String)
-> ([MandateAcssDebitPaymentSchedule'] -> ShowS)
-> Show MandateAcssDebitPaymentSchedule'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MandateAcssDebitPaymentSchedule'] -> ShowS
$cshowList :: [MandateAcssDebitPaymentSchedule'] -> ShowS
show :: MandateAcssDebitPaymentSchedule' -> String
$cshow :: MandateAcssDebitPaymentSchedule' -> String
showsPrec :: Int -> MandateAcssDebitPaymentSchedule' -> ShowS
$cshowsPrec :: Int -> MandateAcssDebitPaymentSchedule' -> ShowS
GHC.Show.Show, MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitPaymentSchedule' -> Bool
(MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitPaymentSchedule' -> Bool)
-> (MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitPaymentSchedule' -> Bool)
-> Eq MandateAcssDebitPaymentSchedule'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitPaymentSchedule' -> Bool
$c/= :: MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitPaymentSchedule' -> Bool
== :: MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitPaymentSchedule' -> Bool
$c== :: MandateAcssDebitPaymentSchedule'
-> MandateAcssDebitPaymentSchedule' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON MandateAcssDebitPaymentSchedule' where
toJSON :: MandateAcssDebitPaymentSchedule' -> Value
toJSON (MandateAcssDebitPaymentSchedule'Other Value
val) = Value
val
toJSON (MandateAcssDebitPaymentSchedule'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (MandateAcssDebitPaymentSchedule'
MandateAcssDebitPaymentSchedule'EnumCombined) = Value
"combined"
toJSON (MandateAcssDebitPaymentSchedule'
MandateAcssDebitPaymentSchedule'EnumInterval) = Value
"interval"
toJSON (MandateAcssDebitPaymentSchedule'
MandateAcssDebitPaymentSchedule'EnumSporadic) = Value
"sporadic"
instance Data.Aeson.Types.FromJSON.FromJSON MandateAcssDebitPaymentSchedule' where
parseJSON :: Value -> Parser MandateAcssDebitPaymentSchedule'
parseJSON Value
val =
MandateAcssDebitPaymentSchedule'
-> Parser MandateAcssDebitPaymentSchedule'
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
"combined" -> MandateAcssDebitPaymentSchedule'
MandateAcssDebitPaymentSchedule'EnumCombined
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"interval" -> MandateAcssDebitPaymentSchedule'
MandateAcssDebitPaymentSchedule'EnumInterval
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"sporadic" -> MandateAcssDebitPaymentSchedule'
MandateAcssDebitPaymentSchedule'EnumSporadic
| Bool
GHC.Base.otherwise -> Value -> MandateAcssDebitPaymentSchedule'
MandateAcssDebitPaymentSchedule'Other Value
val
)
data MandateAcssDebitTransactionType'
=
MandateAcssDebitTransactionType'Other Data.Aeson.Types.Internal.Value
|
MandateAcssDebitTransactionType'Typed Data.Text.Internal.Text
|
MandateAcssDebitTransactionType'EnumBusiness
|
MandateAcssDebitTransactionType'EnumPersonal
deriving (Int -> MandateAcssDebitTransactionType' -> ShowS
[MandateAcssDebitTransactionType'] -> ShowS
MandateAcssDebitTransactionType' -> String
(Int -> MandateAcssDebitTransactionType' -> ShowS)
-> (MandateAcssDebitTransactionType' -> String)
-> ([MandateAcssDebitTransactionType'] -> ShowS)
-> Show MandateAcssDebitTransactionType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MandateAcssDebitTransactionType'] -> ShowS
$cshowList :: [MandateAcssDebitTransactionType'] -> ShowS
show :: MandateAcssDebitTransactionType' -> String
$cshow :: MandateAcssDebitTransactionType' -> String
showsPrec :: Int -> MandateAcssDebitTransactionType' -> ShowS
$cshowsPrec :: Int -> MandateAcssDebitTransactionType' -> ShowS
GHC.Show.Show, MandateAcssDebitTransactionType'
-> MandateAcssDebitTransactionType' -> Bool
(MandateAcssDebitTransactionType'
-> MandateAcssDebitTransactionType' -> Bool)
-> (MandateAcssDebitTransactionType'
-> MandateAcssDebitTransactionType' -> Bool)
-> Eq MandateAcssDebitTransactionType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MandateAcssDebitTransactionType'
-> MandateAcssDebitTransactionType' -> Bool
$c/= :: MandateAcssDebitTransactionType'
-> MandateAcssDebitTransactionType' -> Bool
== :: MandateAcssDebitTransactionType'
-> MandateAcssDebitTransactionType' -> Bool
$c== :: MandateAcssDebitTransactionType'
-> MandateAcssDebitTransactionType' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON MandateAcssDebitTransactionType' where
toJSON :: MandateAcssDebitTransactionType' -> Value
toJSON (MandateAcssDebitTransactionType'Other Value
val) = Value
val
toJSON (MandateAcssDebitTransactionType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (MandateAcssDebitTransactionType'
MandateAcssDebitTransactionType'EnumBusiness) = Value
"business"
toJSON (MandateAcssDebitTransactionType'
MandateAcssDebitTransactionType'EnumPersonal) = Value
"personal"
instance Data.Aeson.Types.FromJSON.FromJSON MandateAcssDebitTransactionType' where
parseJSON :: Value -> Parser MandateAcssDebitTransactionType'
parseJSON Value
val =
MandateAcssDebitTransactionType'
-> Parser MandateAcssDebitTransactionType'
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
"business" -> MandateAcssDebitTransactionType'
MandateAcssDebitTransactionType'EnumBusiness
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"personal" -> MandateAcssDebitTransactionType'
MandateAcssDebitTransactionType'EnumPersonal
| Bool
GHC.Base.otherwise -> Value -> MandateAcssDebitTransactionType'
MandateAcssDebitTransactionType'Other Value
val
)