{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.Topup 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 {-# SOURCE #-} StripeAPI.Types.BalanceTransaction
import {-# SOURCE #-} StripeAPI.Types.Source
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data Topup = Topup
{
Topup -> Int
topupAmount :: GHC.Types.Int,
Topup -> Maybe TopupBalanceTransaction'Variants
topupBalanceTransaction :: (GHC.Maybe.Maybe TopupBalanceTransaction'Variants),
Topup -> Int
topupCreated :: GHC.Types.Int,
Topup -> Text
topupCurrency :: Data.Text.Internal.Text,
Topup -> Maybe Text
topupDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
Topup -> Maybe Int
topupExpectedAvailabilityDate :: (GHC.Maybe.Maybe GHC.Types.Int),
Topup -> Maybe Text
topupFailureCode :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
Topup -> Maybe Text
topupFailureMessage :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
Topup -> Text
topupId :: Data.Text.Internal.Text,
Topup -> Bool
topupLivemode :: GHC.Types.Bool,
Topup -> Object
topupMetadata :: Data.Aeson.Types.Internal.Object,
Topup -> Source
topupSource :: Source,
Topup -> Maybe Text
topupStatementDescriptor :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
Topup -> TopupStatus'
topupStatus :: TopupStatus',
Topup -> Maybe Text
topupTransferGroup :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> Topup -> ShowS
[Topup] -> ShowS
Topup -> String
(Int -> Topup -> ShowS)
-> (Topup -> String) -> ([Topup] -> ShowS) -> Show Topup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Topup] -> ShowS
$cshowList :: [Topup] -> ShowS
show :: Topup -> String
$cshow :: Topup -> String
showsPrec :: Int -> Topup -> ShowS
$cshowsPrec :: Int -> Topup -> ShowS
GHC.Show.Show,
Topup -> Topup -> Bool
(Topup -> Topup -> Bool) -> (Topup -> Topup -> Bool) -> Eq Topup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Topup -> Topup -> Bool
$c/= :: Topup -> Topup -> Bool
== :: Topup -> Topup -> Bool
$c== :: Topup -> Topup -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON Topup where
toJSON :: Topup -> Value
toJSON Topup
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"amount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Int
topupAmount Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"balance_transaction" Text -> Maybe TopupBalanceTransaction'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe TopupBalanceTransaction'Variants
topupBalanceTransaction Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"created" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Int
topupCreated Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"currency" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Text
topupCurrency Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"description" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Text
topupDescription Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"expected_availability_date" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Int
topupExpectedAvailabilityDate Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"failure_code" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Text
topupFailureCode Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"failure_message" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Text
topupFailureMessage Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Text
topupId Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"livemode" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Bool
topupLivemode Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Object
topupMetadata Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"source" Text -> Source -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Source
topupSource Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"statement_descriptor" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Text
topupStatementDescriptor Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"status" Text -> TopupStatus' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> TopupStatus'
topupStatus Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"transfer_group" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Text
topupTransferGroup Topup
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"topup" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: Topup -> Encoding
toEncoding Topup
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"amount" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Int
topupAmount Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"balance_transaction" Text -> Maybe TopupBalanceTransaction'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe TopupBalanceTransaction'Variants
topupBalanceTransaction Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"created" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Int
topupCreated Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"currency" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Text
topupCurrency Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"description" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Text
topupDescription Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"expected_availability_date" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Int
topupExpectedAvailabilityDate Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"failure_code" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Text
topupFailureCode Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"failure_message" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Text
topupFailureMessage Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"id" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Text
topupId Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"livemode" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Bool
topupLivemode Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Object
topupMetadata Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"source" Text -> Source -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Source
topupSource Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"statement_descriptor" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Text
topupStatementDescriptor Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"status" Text -> TopupStatus' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> TopupStatus'
topupStatus Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"transfer_group" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Topup -> Maybe Text
topupTransferGroup Topup
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"topup"))))))))))))))))
instance Data.Aeson.Types.FromJSON.FromJSON Topup where
parseJSON :: Value -> Parser Topup
parseJSON = String -> (Object -> Parser Topup) -> Value -> Parser Topup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"Topup" (\Object
obj -> (((((((((((((((Int
-> Maybe TopupBalanceTransaction'Variants
-> Int
-> Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
-> Parser
(Int
-> Maybe TopupBalanceTransaction'Variants
-> Int
-> Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Int
-> Maybe TopupBalanceTransaction'Variants
-> Int
-> Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup
Topup Parser
(Int
-> Maybe TopupBalanceTransaction'Variants
-> Int
-> Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
-> Parser Int
-> Parser
(Maybe TopupBalanceTransaction'Variants
-> Int
-> Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"amount")) Parser
(Maybe TopupBalanceTransaction'Variants
-> Int
-> Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
-> Parser (Maybe TopupBalanceTransaction'Variants)
-> Parser
(Int
-> Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe TopupBalanceTransaction'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"balance_transaction")) Parser
(Int
-> Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
-> Parser Int
-> Parser
(Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"created")) Parser
(Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
-> Parser Text
-> Parser
(Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
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
"currency")) Parser
(Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
-> Parser (Maybe Text)
-> Parser
(Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
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
"description")) Parser
(Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
-> Parser (Maybe Int)
-> Parser
(Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"expected_availability_date")) Parser
(Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
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
"failure_code")) Parser
(Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
-> Parser (Maybe Text)
-> Parser
(Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
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
"failure_message")) Parser
(Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
-> Parser Text
-> Parser
(Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
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
"id")) Parser
(Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup)
-> Parser Bool
-> Parser
(Object
-> Source -> Maybe Text -> TopupStatus' -> Maybe Text -> Topup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"livemode")) Parser
(Object
-> Source -> Maybe Text -> TopupStatus' -> Maybe Text -> Topup)
-> Parser Object
-> Parser
(Source -> Maybe Text -> TopupStatus' -> Maybe Text -> Topup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Object
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"metadata")) Parser
(Source -> Maybe Text -> TopupStatus' -> Maybe Text -> Topup)
-> Parser Source
-> Parser (Maybe Text -> TopupStatus' -> Maybe Text -> Topup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Source
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"source")) Parser (Maybe Text -> TopupStatus' -> Maybe Text -> Topup)
-> Parser (Maybe Text)
-> Parser (TopupStatus' -> Maybe Text -> Topup)
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
"statement_descriptor")) Parser (TopupStatus' -> Maybe Text -> Topup)
-> Parser TopupStatus' -> Parser (Maybe Text -> Topup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser TopupStatus'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"status")) Parser (Maybe Text -> Topup) -> Parser (Maybe Text) -> Parser Topup
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
"transfer_group"))
mkTopup ::
GHC.Types.Int ->
GHC.Types.Int ->
Data.Text.Internal.Text ->
Data.Text.Internal.Text ->
GHC.Types.Bool ->
Data.Aeson.Types.Internal.Object ->
Source ->
TopupStatus' ->
Topup
mkTopup :: Int
-> Int
-> Text
-> Text
-> Bool
-> Object
-> Source
-> TopupStatus'
-> Topup
mkTopup Int
topupAmount Int
topupCreated Text
topupCurrency Text
topupId Bool
topupLivemode Object
topupMetadata Source
topupSource TopupStatus'
topupStatus =
Topup :: Int
-> Maybe TopupBalanceTransaction'Variants
-> Int
-> Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> Object
-> Source
-> Maybe Text
-> TopupStatus'
-> Maybe Text
-> Topup
Topup
{ topupAmount :: Int
topupAmount = Int
topupAmount,
topupBalanceTransaction :: Maybe TopupBalanceTransaction'Variants
topupBalanceTransaction = Maybe TopupBalanceTransaction'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
topupCreated :: Int
topupCreated = Int
topupCreated,
topupCurrency :: Text
topupCurrency = Text
topupCurrency,
topupDescription :: Maybe Text
topupDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
topupExpectedAvailabilityDate :: Maybe Int
topupExpectedAvailabilityDate = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
topupFailureCode :: Maybe Text
topupFailureCode = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
topupFailureMessage :: Maybe Text
topupFailureMessage = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
topupId :: Text
topupId = Text
topupId,
topupLivemode :: Bool
topupLivemode = Bool
topupLivemode,
topupMetadata :: Object
topupMetadata = Object
topupMetadata,
topupSource :: Source
topupSource = Source
topupSource,
topupStatementDescriptor :: Maybe Text
topupStatementDescriptor = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
topupStatus :: TopupStatus'
topupStatus = TopupStatus'
topupStatus,
topupTransferGroup :: Maybe Text
topupTransferGroup = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}
data TopupBalanceTransaction'Variants
= TopupBalanceTransaction'Text Data.Text.Internal.Text
| TopupBalanceTransaction'BalanceTransaction BalanceTransaction
deriving (Int -> TopupBalanceTransaction'Variants -> ShowS
[TopupBalanceTransaction'Variants] -> ShowS
TopupBalanceTransaction'Variants -> String
(Int -> TopupBalanceTransaction'Variants -> ShowS)
-> (TopupBalanceTransaction'Variants -> String)
-> ([TopupBalanceTransaction'Variants] -> ShowS)
-> Show TopupBalanceTransaction'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TopupBalanceTransaction'Variants] -> ShowS
$cshowList :: [TopupBalanceTransaction'Variants] -> ShowS
show :: TopupBalanceTransaction'Variants -> String
$cshow :: TopupBalanceTransaction'Variants -> String
showsPrec :: Int -> TopupBalanceTransaction'Variants -> ShowS
$cshowsPrec :: Int -> TopupBalanceTransaction'Variants -> ShowS
GHC.Show.Show, TopupBalanceTransaction'Variants
-> TopupBalanceTransaction'Variants -> Bool
(TopupBalanceTransaction'Variants
-> TopupBalanceTransaction'Variants -> Bool)
-> (TopupBalanceTransaction'Variants
-> TopupBalanceTransaction'Variants -> Bool)
-> Eq TopupBalanceTransaction'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TopupBalanceTransaction'Variants
-> TopupBalanceTransaction'Variants -> Bool
$c/= :: TopupBalanceTransaction'Variants
-> TopupBalanceTransaction'Variants -> Bool
== :: TopupBalanceTransaction'Variants
-> TopupBalanceTransaction'Variants -> Bool
$c== :: TopupBalanceTransaction'Variants
-> TopupBalanceTransaction'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON TopupBalanceTransaction'Variants where
toJSON :: TopupBalanceTransaction'Variants -> Value
toJSON (TopupBalanceTransaction'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
toJSON (TopupBalanceTransaction'BalanceTransaction BalanceTransaction
a) = BalanceTransaction -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON BalanceTransaction
a
instance Data.Aeson.Types.FromJSON.FromJSON TopupBalanceTransaction'Variants where
parseJSON :: Value -> Parser TopupBalanceTransaction'Variants
parseJSON Value
val = case (Text -> TopupBalanceTransaction'Variants
TopupBalanceTransaction'Text (Text -> TopupBalanceTransaction'Variants)
-> Result Text -> Result TopupBalanceTransaction'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result TopupBalanceTransaction'Variants
-> Result TopupBalanceTransaction'Variants
-> Result TopupBalanceTransaction'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((BalanceTransaction -> TopupBalanceTransaction'Variants
TopupBalanceTransaction'BalanceTransaction (BalanceTransaction -> TopupBalanceTransaction'Variants)
-> Result BalanceTransaction
-> Result TopupBalanceTransaction'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result BalanceTransaction
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result TopupBalanceTransaction'Variants
-> Result TopupBalanceTransaction'Variants
-> Result TopupBalanceTransaction'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result TopupBalanceTransaction'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
Data.Aeson.Types.Internal.Success TopupBalanceTransaction'Variants
a -> TopupBalanceTransaction'Variants
-> Parser TopupBalanceTransaction'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure TopupBalanceTransaction'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String -> Parser TopupBalanceTransaction'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a
data TopupStatus'
=
TopupStatus'Other Data.Aeson.Types.Internal.Value
|
TopupStatus'Typed Data.Text.Internal.Text
|
TopupStatus'EnumCanceled
|
TopupStatus'EnumFailed
|
TopupStatus'EnumPending
|
TopupStatus'EnumReversed
|
TopupStatus'EnumSucceeded
deriving (Int -> TopupStatus' -> ShowS
[TopupStatus'] -> ShowS
TopupStatus' -> String
(Int -> TopupStatus' -> ShowS)
-> (TopupStatus' -> String)
-> ([TopupStatus'] -> ShowS)
-> Show TopupStatus'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TopupStatus'] -> ShowS
$cshowList :: [TopupStatus'] -> ShowS
show :: TopupStatus' -> String
$cshow :: TopupStatus' -> String
showsPrec :: Int -> TopupStatus' -> ShowS
$cshowsPrec :: Int -> TopupStatus' -> ShowS
GHC.Show.Show, TopupStatus' -> TopupStatus' -> Bool
(TopupStatus' -> TopupStatus' -> Bool)
-> (TopupStatus' -> TopupStatus' -> Bool) -> Eq TopupStatus'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TopupStatus' -> TopupStatus' -> Bool
$c/= :: TopupStatus' -> TopupStatus' -> Bool
== :: TopupStatus' -> TopupStatus' -> Bool
$c== :: TopupStatus' -> TopupStatus' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON TopupStatus' where
toJSON :: TopupStatus' -> Value
toJSON (TopupStatus'Other Value
val) = Value
val
toJSON (TopupStatus'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (TopupStatus'
TopupStatus'EnumCanceled) = Value
"canceled"
toJSON (TopupStatus'
TopupStatus'EnumFailed) = Value
"failed"
toJSON (TopupStatus'
TopupStatus'EnumPending) = Value
"pending"
toJSON (TopupStatus'
TopupStatus'EnumReversed) = Value
"reversed"
toJSON (TopupStatus'
TopupStatus'EnumSucceeded) = Value
"succeeded"
instance Data.Aeson.Types.FromJSON.FromJSON TopupStatus' where
parseJSON :: Value -> Parser TopupStatus'
parseJSON Value
val =
TopupStatus' -> Parser TopupStatus'
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
"canceled" -> TopupStatus'
TopupStatus'EnumCanceled
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"failed" -> TopupStatus'
TopupStatus'EnumFailed
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"pending" -> TopupStatus'
TopupStatus'EnumPending
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"reversed" -> TopupStatus'
TopupStatus'EnumReversed
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"succeeded" -> TopupStatus'
TopupStatus'EnumSucceeded
| Bool
GHC.Base.otherwise -> Value -> TopupStatus'
TopupStatus'Other Value
val
)