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