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