{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.SourceMandateNotificationSepaDebitData 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 SourceMandateNotificationSepaDebitData = SourceMandateNotificationSepaDebitData
{
SourceMandateNotificationSepaDebitData -> Maybe Text
sourceMandateNotificationSepaDebitDataCreditorIdentifier :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
SourceMandateNotificationSepaDebitData -> Maybe Text
sourceMandateNotificationSepaDebitDataLast4 :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
SourceMandateNotificationSepaDebitData -> Maybe Text
sourceMandateNotificationSepaDebitDataMandateReference :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> SourceMandateNotificationSepaDebitData -> ShowS
[SourceMandateNotificationSepaDebitData] -> ShowS
SourceMandateNotificationSepaDebitData -> String
(Int -> SourceMandateNotificationSepaDebitData -> ShowS)
-> (SourceMandateNotificationSepaDebitData -> String)
-> ([SourceMandateNotificationSepaDebitData] -> ShowS)
-> Show SourceMandateNotificationSepaDebitData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceMandateNotificationSepaDebitData] -> ShowS
$cshowList :: [SourceMandateNotificationSepaDebitData] -> ShowS
show :: SourceMandateNotificationSepaDebitData -> String
$cshow :: SourceMandateNotificationSepaDebitData -> String
showsPrec :: Int -> SourceMandateNotificationSepaDebitData -> ShowS
$cshowsPrec :: Int -> SourceMandateNotificationSepaDebitData -> ShowS
GHC.Show.Show,
SourceMandateNotificationSepaDebitData
-> SourceMandateNotificationSepaDebitData -> Bool
(SourceMandateNotificationSepaDebitData
-> SourceMandateNotificationSepaDebitData -> Bool)
-> (SourceMandateNotificationSepaDebitData
-> SourceMandateNotificationSepaDebitData -> Bool)
-> Eq SourceMandateNotificationSepaDebitData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceMandateNotificationSepaDebitData
-> SourceMandateNotificationSepaDebitData -> Bool
$c/= :: SourceMandateNotificationSepaDebitData
-> SourceMandateNotificationSepaDebitData -> Bool
== :: SourceMandateNotificationSepaDebitData
-> SourceMandateNotificationSepaDebitData -> Bool
$c== :: SourceMandateNotificationSepaDebitData
-> SourceMandateNotificationSepaDebitData -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON SourceMandateNotificationSepaDebitData where
toJSON :: SourceMandateNotificationSepaDebitData -> Value
toJSON SourceMandateNotificationSepaDebitData
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"creditor_identifier" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SourceMandateNotificationSepaDebitData -> Maybe Text
sourceMandateNotificationSepaDebitDataCreditorIdentifier SourceMandateNotificationSepaDebitData
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"last4" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SourceMandateNotificationSepaDebitData -> Maybe Text
sourceMandateNotificationSepaDebitDataLast4 SourceMandateNotificationSepaDebitData
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"mandate_reference" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SourceMandateNotificationSepaDebitData -> Maybe Text
sourceMandateNotificationSepaDebitDataMandateReference SourceMandateNotificationSepaDebitData
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: SourceMandateNotificationSepaDebitData -> Encoding
toEncoding SourceMandateNotificationSepaDebitData
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"creditor_identifier" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SourceMandateNotificationSepaDebitData -> Maybe Text
sourceMandateNotificationSepaDebitDataCreditorIdentifier SourceMandateNotificationSepaDebitData
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"last4" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SourceMandateNotificationSepaDebitData -> Maybe Text
sourceMandateNotificationSepaDebitDataLast4 SourceMandateNotificationSepaDebitData
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"mandate_reference" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SourceMandateNotificationSepaDebitData -> Maybe Text
sourceMandateNotificationSepaDebitDataMandateReference SourceMandateNotificationSepaDebitData
obj)))
instance Data.Aeson.Types.FromJSON.FromJSON SourceMandateNotificationSepaDebitData where
parseJSON :: Value -> Parser SourceMandateNotificationSepaDebitData
parseJSON = String
-> (Object -> Parser SourceMandateNotificationSepaDebitData)
-> Value
-> Parser SourceMandateNotificationSepaDebitData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"SourceMandateNotificationSepaDebitData" (\Object
obj -> (((Maybe Text
-> Maybe Text
-> Maybe Text
-> SourceMandateNotificationSepaDebitData)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> SourceMandateNotificationSepaDebitData)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe Text
-> Maybe Text
-> SourceMandateNotificationSepaDebitData
SourceMandateNotificationSepaDebitData Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> SourceMandateNotificationSepaDebitData)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text -> SourceMandateNotificationSepaDebitData)
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
"creditor_identifier")) Parser
(Maybe Text
-> Maybe Text -> SourceMandateNotificationSepaDebitData)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> SourceMandateNotificationSepaDebitData)
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
"last4")) Parser (Maybe Text -> SourceMandateNotificationSepaDebitData)
-> Parser (Maybe Text)
-> Parser SourceMandateNotificationSepaDebitData
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
"mandate_reference"))
mkSourceMandateNotificationSepaDebitData :: SourceMandateNotificationSepaDebitData
mkSourceMandateNotificationSepaDebitData :: SourceMandateNotificationSepaDebitData
mkSourceMandateNotificationSepaDebitData =
SourceMandateNotificationSepaDebitData :: Maybe Text
-> Maybe Text
-> Maybe Text
-> SourceMandateNotificationSepaDebitData
SourceMandateNotificationSepaDebitData
{ sourceMandateNotificationSepaDebitDataCreditorIdentifier :: Maybe Text
sourceMandateNotificationSepaDebitDataCreditorIdentifier = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
sourceMandateNotificationSepaDebitDataLast4 :: Maybe Text
sourceMandateNotificationSepaDebitDataLast4 = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
sourceMandateNotificationSepaDebitDataMandateReference :: Maybe Text
sourceMandateNotificationSepaDebitDataMandateReference = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}