{-# LANGUAGE MultiWayIf #-}
-- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator.
{-# LANGUAGE OverloadedStrings #-}

-- | Contains the types generated from the schema BalanceTransaction
module StripeAPI.Types.BalanceTransaction 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.ApplicationFee
import {-# SOURCE #-} StripeAPI.Types.Charge
import {-# SOURCE #-} StripeAPI.Types.ConnectCollectionTransfer
import {-# SOURCE #-} StripeAPI.Types.Dispute
import {-# SOURCE #-} StripeAPI.Types.Fee
import {-# SOURCE #-} StripeAPI.Types.FeeRefund
import {-# SOURCE #-} StripeAPI.Types.Issuing_Authorization
import {-# SOURCE #-} StripeAPI.Types.Issuing_Dispute
import {-# SOURCE #-} StripeAPI.Types.Issuing_Transaction
import {-# SOURCE #-} StripeAPI.Types.Payout
import {-# SOURCE #-} StripeAPI.Types.PlatformTaxFee
import {-# SOURCE #-} StripeAPI.Types.Refund
import {-# SOURCE #-} StripeAPI.Types.ReserveTransaction
import {-# SOURCE #-} StripeAPI.Types.TaxDeductedAtSource
import {-# SOURCE #-} StripeAPI.Types.Topup
import {-# SOURCE #-} StripeAPI.Types.Transfer
import {-# SOURCE #-} StripeAPI.Types.TransferReversal
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.balance_transaction@ in the specification.
--
-- Balance transactions represent funds moving through your Stripe account.
-- They\'re created for every type of transaction that comes into or flows out of your Stripe account balance.
--
-- Related guide: [Balance Transaction Types](https:\/\/stripe.com\/docs\/reports\/balance-transaction-types).
data BalanceTransaction = BalanceTransaction
  { -- | amount: Gross amount of the transaction, in %s.
    BalanceTransaction -> Int
balanceTransactionAmount :: GHC.Types.Int,
    -- | available_on: The date the transaction\'s net funds will become available in the Stripe balance.
    BalanceTransaction -> Int
balanceTransactionAvailableOn :: GHC.Types.Int,
    -- | created: Time at which the object was created. Measured in seconds since the Unix epoch.
    BalanceTransaction -> Int
balanceTransactionCreated :: GHC.Types.Int,
    -- | currency: Three-letter [ISO currency code](https:\/\/www.iso.org\/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https:\/\/stripe.com\/docs\/currencies).
    BalanceTransaction -> Text
balanceTransactionCurrency :: Data.Text.Internal.Text,
    -- | description: An arbitrary string attached to the object. Often useful for displaying to users.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    BalanceTransaction -> Maybe Text
balanceTransactionDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | exchange_rate: The exchange rate used, if applicable, for this transaction. Specifically, if money was converted from currency A to currency B, then the \`amount\` in currency A, times \`exchange_rate\`, would be the \`amount\` in currency B. For example, suppose you charged a customer 10.00 EUR. Then the PaymentIntent\'s \`amount\` would be \`1000\` and \`currency\` would be \`eur\`. Suppose this was converted into 12.34 USD in your Stripe account. Then the BalanceTransaction\'s \`amount\` would be \`1234\`, \`currency\` would be \`usd\`, and \`exchange_rate\` would be \`1.234\`.
    BalanceTransaction -> Maybe Double
balanceTransactionExchangeRate :: (GHC.Maybe.Maybe GHC.Types.Double),
    -- | fee: Fees (in %s) paid for this transaction.
    BalanceTransaction -> Int
balanceTransactionFee :: GHC.Types.Int,
    -- | fee_details: Detailed breakdown of fees (in %s) paid for this transaction.
    BalanceTransaction -> [Fee]
balanceTransactionFeeDetails :: ([Fee]),
    -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    BalanceTransaction -> Text
balanceTransactionId :: Data.Text.Internal.Text,
    -- | net: Net amount of the transaction, in %s.
    BalanceTransaction -> Int
balanceTransactionNet :: GHC.Types.Int,
    -- | reporting_category: [Learn more](https:\/\/stripe.com\/docs\/reports\/reporting-categories) about how reporting categories can help you understand balance transactions from an accounting perspective.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    BalanceTransaction -> Text
balanceTransactionReportingCategory :: Data.Text.Internal.Text,
    -- | source: The Stripe object to which this transaction is related.
    BalanceTransaction -> Maybe BalanceTransactionSource'Variants
balanceTransactionSource :: (GHC.Maybe.Maybe BalanceTransactionSource'Variants),
    -- | status: If the transaction\'s net funds are available in the Stripe balance yet. Either \`available\` or \`pending\`.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    BalanceTransaction -> Text
balanceTransactionStatus :: Data.Text.Internal.Text,
    -- | type: Transaction type: \`adjustment\`, \`advance\`, \`advance_funding\`, \`anticipation_repayment\`, \`application_fee\`, \`application_fee_refund\`, \`charge\`, \`connect_collection_transfer\`, \`contribution\`, \`issuing_authorization_hold\`, \`issuing_authorization_release\`, \`issuing_dispute\`, \`issuing_transaction\`, \`payment\`, \`payment_failure_refund\`, \`payment_refund\`, \`payout\`, \`payout_cancel\`, \`payout_failure\`, \`refund\`, \`refund_failure\`, \`reserve_transaction\`, \`reserved_funds\`, \`stripe_fee\`, \`stripe_fx_fee\`, \`tax_fee\`, \`topup\`, \`topup_reversal\`, \`transfer\`, \`transfer_cancel\`, \`transfer_failure\`, or \`transfer_refund\`. [Learn more](https:\/\/stripe.com\/docs\/reports\/balance-transaction-types) about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider \`reporting_category\` instead.
    BalanceTransaction -> BalanceTransactionType'
balanceTransactionType :: BalanceTransactionType'
  }
  deriving
    ( Int -> BalanceTransaction -> ShowS
[BalanceTransaction] -> ShowS
BalanceTransaction -> String
(Int -> BalanceTransaction -> ShowS)
-> (BalanceTransaction -> String)
-> ([BalanceTransaction] -> ShowS)
-> Show BalanceTransaction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BalanceTransaction] -> ShowS
$cshowList :: [BalanceTransaction] -> ShowS
show :: BalanceTransaction -> String
$cshow :: BalanceTransaction -> String
showsPrec :: Int -> BalanceTransaction -> ShowS
$cshowsPrec :: Int -> BalanceTransaction -> ShowS
GHC.Show.Show,
      BalanceTransaction -> BalanceTransaction -> Bool
(BalanceTransaction -> BalanceTransaction -> Bool)
-> (BalanceTransaction -> BalanceTransaction -> Bool)
-> Eq BalanceTransaction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BalanceTransaction -> BalanceTransaction -> Bool
$c/= :: BalanceTransaction -> BalanceTransaction -> Bool
== :: BalanceTransaction -> BalanceTransaction -> Bool
$c== :: BalanceTransaction -> BalanceTransaction -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON BalanceTransaction where
  toJSON :: BalanceTransaction -> Value
toJSON BalanceTransaction
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..= BalanceTransaction -> Int
balanceTransactionAmount BalanceTransaction
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"available_on" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Int
balanceTransactionAvailableOn BalanceTransaction
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..= BalanceTransaction -> Int
balanceTransactionCreated BalanceTransaction
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..= BalanceTransaction -> Text
balanceTransactionCurrency BalanceTransaction
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..= BalanceTransaction -> Maybe Text
balanceTransactionDescription BalanceTransaction
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"exchange_rate" Text -> Maybe Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Maybe Double
balanceTransactionExchangeRate BalanceTransaction
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"fee" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Int
balanceTransactionFee BalanceTransaction
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"fee_details" Text -> [Fee] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> [Fee]
balanceTransactionFeeDetails BalanceTransaction
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..= BalanceTransaction -> Text
balanceTransactionId BalanceTransaction
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"net" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Int
balanceTransactionNet BalanceTransaction
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"reporting_category" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Text
balanceTransactionReportingCategory BalanceTransaction
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"source" Text -> Maybe BalanceTransactionSource'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Maybe BalanceTransactionSource'Variants
balanceTransactionSource BalanceTransaction
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"status" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Text
balanceTransactionStatus BalanceTransaction
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> BalanceTransactionType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> BalanceTransactionType'
balanceTransactionType BalanceTransaction
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
"balance_transaction" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: BalanceTransaction -> Encoding
toEncoding BalanceTransaction
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..= BalanceTransaction -> Int
balanceTransactionAmount BalanceTransaction
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"available_on" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Int
balanceTransactionAvailableOn BalanceTransaction
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..= BalanceTransaction -> Int
balanceTransactionCreated BalanceTransaction
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..= BalanceTransaction -> Text
balanceTransactionCurrency BalanceTransaction
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..= BalanceTransaction -> Maybe Text
balanceTransactionDescription BalanceTransaction
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"exchange_rate" Text -> Maybe Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Maybe Double
balanceTransactionExchangeRate BalanceTransaction
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"fee" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Int
balanceTransactionFee BalanceTransaction
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"fee_details" Text -> [Fee] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> [Fee]
balanceTransactionFeeDetails BalanceTransaction
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..= BalanceTransaction -> Text
balanceTransactionId BalanceTransaction
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"net" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Int
balanceTransactionNet BalanceTransaction
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"reporting_category" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Text
balanceTransactionReportingCategory BalanceTransaction
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"source" Text -> Maybe BalanceTransactionSource'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Maybe BalanceTransactionSource'Variants
balanceTransactionSource BalanceTransaction
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"status" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> Text
balanceTransactionStatus BalanceTransaction
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"type" Text -> BalanceTransactionType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BalanceTransaction -> BalanceTransactionType'
balanceTransactionType BalanceTransaction
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
"balance_transaction")))))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON BalanceTransaction where
  parseJSON :: Value -> Parser BalanceTransaction
parseJSON = String
-> (Object -> Parser BalanceTransaction)
-> Value
-> Parser BalanceTransaction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"BalanceTransaction" (\Object
obj -> ((((((((((((((Int
 -> Int
 -> Int
 -> Text
 -> Maybe Text
 -> Maybe Double
 -> Int
 -> [Fee]
 -> Text
 -> Int
 -> Text
 -> Maybe BalanceTransactionSource'Variants
 -> Text
 -> BalanceTransactionType'
 -> BalanceTransaction)
-> Parser
     (Int
      -> Int
      -> Int
      -> Text
      -> Maybe Text
      -> Maybe Double
      -> Int
      -> [Fee]
      -> Text
      -> Int
      -> Text
      -> Maybe BalanceTransactionSource'Variants
      -> Text
      -> BalanceTransactionType'
      -> BalanceTransaction)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Int
-> Int
-> Int
-> Text
-> Maybe Text
-> Maybe Double
-> Int
-> [Fee]
-> Text
-> Int
-> Text
-> Maybe BalanceTransactionSource'Variants
-> Text
-> BalanceTransactionType'
-> BalanceTransaction
BalanceTransaction Parser
  (Int
   -> Int
   -> Int
   -> Text
   -> Maybe Text
   -> Maybe Double
   -> Int
   -> [Fee]
   -> Text
   -> Int
   -> Text
   -> Maybe BalanceTransactionSource'Variants
   -> Text
   -> BalanceTransactionType'
   -> BalanceTransaction)
-> Parser Int
-> Parser
     (Int
      -> Int
      -> Text
      -> Maybe Text
      -> Maybe Double
      -> Int
      -> [Fee]
      -> Text
      -> Int
      -> Text
      -> Maybe BalanceTransactionSource'Variants
      -> Text
      -> BalanceTransactionType'
      -> BalanceTransaction)
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
  (Int
   -> Int
   -> Text
   -> Maybe Text
   -> Maybe Double
   -> Int
   -> [Fee]
   -> Text
   -> Int
   -> Text
   -> Maybe BalanceTransactionSource'Variants
   -> Text
   -> BalanceTransactionType'
   -> BalanceTransaction)
-> Parser Int
-> Parser
     (Int
      -> Text
      -> Maybe Text
      -> Maybe Double
      -> Int
      -> [Fee]
      -> Text
      -> Int
      -> Text
      -> Maybe BalanceTransactionSource'Variants
      -> Text
      -> BalanceTransactionType'
      -> BalanceTransaction)
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
"available_on")) Parser
  (Int
   -> Text
   -> Maybe Text
   -> Maybe Double
   -> Int
   -> [Fee]
   -> Text
   -> Int
   -> Text
   -> Maybe BalanceTransactionSource'Variants
   -> Text
   -> BalanceTransactionType'
   -> BalanceTransaction)
-> Parser Int
-> Parser
     (Text
      -> Maybe Text
      -> Maybe Double
      -> Int
      -> [Fee]
      -> Text
      -> Int
      -> Text
      -> Maybe BalanceTransactionSource'Variants
      -> Text
      -> BalanceTransactionType'
      -> BalanceTransaction)
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 Double
   -> Int
   -> [Fee]
   -> Text
   -> Int
   -> Text
   -> Maybe BalanceTransactionSource'Variants
   -> Text
   -> BalanceTransactionType'
   -> BalanceTransaction)
-> Parser Text
-> Parser
     (Maybe Text
      -> Maybe Double
      -> Int
      -> [Fee]
      -> Text
      -> Int
      -> Text
      -> Maybe BalanceTransactionSource'Variants
      -> Text
      -> BalanceTransactionType'
      -> BalanceTransaction)
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 Double
   -> Int
   -> [Fee]
   -> Text
   -> Int
   -> Text
   -> Maybe BalanceTransactionSource'Variants
   -> Text
   -> BalanceTransactionType'
   -> BalanceTransaction)
-> Parser (Maybe Text)
-> Parser
     (Maybe Double
      -> Int
      -> [Fee]
      -> Text
      -> Int
      -> Text
      -> Maybe BalanceTransactionSource'Variants
      -> Text
      -> BalanceTransactionType'
      -> BalanceTransaction)
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 Double
   -> Int
   -> [Fee]
   -> Text
   -> Int
   -> Text
   -> Maybe BalanceTransactionSource'Variants
   -> Text
   -> BalanceTransactionType'
   -> BalanceTransaction)
-> Parser (Maybe Double)
-> Parser
     (Int
      -> [Fee]
      -> Text
      -> Int
      -> Text
      -> Maybe BalanceTransactionSource'Variants
      -> Text
      -> BalanceTransactionType'
      -> BalanceTransaction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"exchange_rate")) Parser
  (Int
   -> [Fee]
   -> Text
   -> Int
   -> Text
   -> Maybe BalanceTransactionSource'Variants
   -> Text
   -> BalanceTransactionType'
   -> BalanceTransaction)
-> Parser Int
-> Parser
     ([Fee]
      -> Text
      -> Int
      -> Text
      -> Maybe BalanceTransactionSource'Variants
      -> Text
      -> BalanceTransactionType'
      -> BalanceTransaction)
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
"fee")) Parser
  ([Fee]
   -> Text
   -> Int
   -> Text
   -> Maybe BalanceTransactionSource'Variants
   -> Text
   -> BalanceTransactionType'
   -> BalanceTransaction)
-> Parser [Fee]
-> Parser
     (Text
      -> Int
      -> Text
      -> Maybe BalanceTransactionSource'Variants
      -> Text
      -> BalanceTransactionType'
      -> BalanceTransaction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser [Fee]
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"fee_details")) Parser
  (Text
   -> Int
   -> Text
   -> Maybe BalanceTransactionSource'Variants
   -> Text
   -> BalanceTransactionType'
   -> BalanceTransaction)
-> Parser Text
-> Parser
     (Int
      -> Text
      -> Maybe BalanceTransactionSource'Variants
      -> Text
      -> BalanceTransactionType'
      -> BalanceTransaction)
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
  (Int
   -> Text
   -> Maybe BalanceTransactionSource'Variants
   -> Text
   -> BalanceTransactionType'
   -> BalanceTransaction)
-> Parser Int
-> Parser
     (Text
      -> Maybe BalanceTransactionSource'Variants
      -> Text
      -> BalanceTransactionType'
      -> BalanceTransaction)
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
"net")) Parser
  (Text
   -> Maybe BalanceTransactionSource'Variants
   -> Text
   -> BalanceTransactionType'
   -> BalanceTransaction)
-> Parser Text
-> Parser
     (Maybe BalanceTransactionSource'Variants
      -> Text -> BalanceTransactionType' -> BalanceTransaction)
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
"reporting_category")) Parser
  (Maybe BalanceTransactionSource'Variants
   -> Text -> BalanceTransactionType' -> BalanceTransaction)
-> Parser (Maybe BalanceTransactionSource'Variants)
-> Parser (Text -> BalanceTransactionType' -> BalanceTransaction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe BalanceTransactionSource'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"source")) Parser (Text -> BalanceTransactionType' -> BalanceTransaction)
-> Parser Text
-> Parser (BalanceTransactionType' -> BalanceTransaction)
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
"status")) Parser (BalanceTransactionType' -> BalanceTransaction)
-> Parser BalanceTransactionType' -> Parser BalanceTransaction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser BalanceTransactionType'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"type"))

-- | Create a new 'BalanceTransaction' with all required fields.
mkBalanceTransaction ::
  -- | 'balanceTransactionAmount'
  GHC.Types.Int ->
  -- | 'balanceTransactionAvailableOn'
  GHC.Types.Int ->
  -- | 'balanceTransactionCreated'
  GHC.Types.Int ->
  -- | 'balanceTransactionCurrency'
  Data.Text.Internal.Text ->
  -- | 'balanceTransactionFee'
  GHC.Types.Int ->
  -- | 'balanceTransactionFeeDetails'
  [Fee] ->
  -- | 'balanceTransactionId'
  Data.Text.Internal.Text ->
  -- | 'balanceTransactionNet'
  GHC.Types.Int ->
  -- | 'balanceTransactionReportingCategory'
  Data.Text.Internal.Text ->
  -- | 'balanceTransactionStatus'
  Data.Text.Internal.Text ->
  -- | 'balanceTransactionType'
  BalanceTransactionType' ->
  BalanceTransaction
mkBalanceTransaction :: Int
-> Int
-> Int
-> Text
-> Int
-> [Fee]
-> Text
-> Int
-> Text
-> Text
-> BalanceTransactionType'
-> BalanceTransaction
mkBalanceTransaction Int
balanceTransactionAmount Int
balanceTransactionAvailableOn Int
balanceTransactionCreated Text
balanceTransactionCurrency Int
balanceTransactionFee [Fee]
balanceTransactionFeeDetails Text
balanceTransactionId Int
balanceTransactionNet Text
balanceTransactionReportingCategory Text
balanceTransactionStatus BalanceTransactionType'
balanceTransactionType =
  BalanceTransaction :: Int
-> Int
-> Int
-> Text
-> Maybe Text
-> Maybe Double
-> Int
-> [Fee]
-> Text
-> Int
-> Text
-> Maybe BalanceTransactionSource'Variants
-> Text
-> BalanceTransactionType'
-> BalanceTransaction
BalanceTransaction
    { balanceTransactionAmount :: Int
balanceTransactionAmount = Int
balanceTransactionAmount,
      balanceTransactionAvailableOn :: Int
balanceTransactionAvailableOn = Int
balanceTransactionAvailableOn,
      balanceTransactionCreated :: Int
balanceTransactionCreated = Int
balanceTransactionCreated,
      balanceTransactionCurrency :: Text
balanceTransactionCurrency = Text
balanceTransactionCurrency,
      balanceTransactionDescription :: Maybe Text
balanceTransactionDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      balanceTransactionExchangeRate :: Maybe Double
balanceTransactionExchangeRate = Maybe Double
forall a. Maybe a
GHC.Maybe.Nothing,
      balanceTransactionFee :: Int
balanceTransactionFee = Int
balanceTransactionFee,
      balanceTransactionFeeDetails :: [Fee]
balanceTransactionFeeDetails = [Fee]
balanceTransactionFeeDetails,
      balanceTransactionId :: Text
balanceTransactionId = Text
balanceTransactionId,
      balanceTransactionNet :: Int
balanceTransactionNet = Int
balanceTransactionNet,
      balanceTransactionReportingCategory :: Text
balanceTransactionReportingCategory = Text
balanceTransactionReportingCategory,
      balanceTransactionSource :: Maybe BalanceTransactionSource'Variants
balanceTransactionSource = Maybe BalanceTransactionSource'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      balanceTransactionStatus :: Text
balanceTransactionStatus = Text
balanceTransactionStatus,
      balanceTransactionType :: BalanceTransactionType'
balanceTransactionType = BalanceTransactionType'
balanceTransactionType
    }

-- | Defines the oneOf schema located at @components.schemas.balance_transaction.properties.source.anyOf@ in the specification.
--
-- The Stripe object to which this transaction is related.
data BalanceTransactionSource'Variants
  = BalanceTransactionSource'Text Data.Text.Internal.Text
  | BalanceTransactionSource'ApplicationFee ApplicationFee
  | BalanceTransactionSource'Charge Charge
  | BalanceTransactionSource'ConnectCollectionTransfer ConnectCollectionTransfer
  | BalanceTransactionSource'Dispute Dispute
  | BalanceTransactionSource'FeeRefund FeeRefund
  | BalanceTransactionSource'Issuing'authorization Issuing'authorization
  | BalanceTransactionSource'Issuing'dispute Issuing'dispute
  | BalanceTransactionSource'Issuing'transaction Issuing'transaction
  | BalanceTransactionSource'Payout Payout
  | BalanceTransactionSource'PlatformTaxFee PlatformTaxFee
  | BalanceTransactionSource'Refund Refund
  | BalanceTransactionSource'ReserveTransaction ReserveTransaction
  | BalanceTransactionSource'TaxDeductedAtSource TaxDeductedAtSource
  | BalanceTransactionSource'Topup Topup
  | BalanceTransactionSource'Transfer Transfer
  | BalanceTransactionSource'TransferReversal TransferReversal
  deriving (Int -> BalanceTransactionSource'Variants -> ShowS
[BalanceTransactionSource'Variants] -> ShowS
BalanceTransactionSource'Variants -> String
(Int -> BalanceTransactionSource'Variants -> ShowS)
-> (BalanceTransactionSource'Variants -> String)
-> ([BalanceTransactionSource'Variants] -> ShowS)
-> Show BalanceTransactionSource'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BalanceTransactionSource'Variants] -> ShowS
$cshowList :: [BalanceTransactionSource'Variants] -> ShowS
show :: BalanceTransactionSource'Variants -> String
$cshow :: BalanceTransactionSource'Variants -> String
showsPrec :: Int -> BalanceTransactionSource'Variants -> ShowS
$cshowsPrec :: Int -> BalanceTransactionSource'Variants -> ShowS
GHC.Show.Show, BalanceTransactionSource'Variants
-> BalanceTransactionSource'Variants -> Bool
(BalanceTransactionSource'Variants
 -> BalanceTransactionSource'Variants -> Bool)
-> (BalanceTransactionSource'Variants
    -> BalanceTransactionSource'Variants -> Bool)
-> Eq BalanceTransactionSource'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BalanceTransactionSource'Variants
-> BalanceTransactionSource'Variants -> Bool
$c/= :: BalanceTransactionSource'Variants
-> BalanceTransactionSource'Variants -> Bool
== :: BalanceTransactionSource'Variants
-> BalanceTransactionSource'Variants -> Bool
$c== :: BalanceTransactionSource'Variants
-> BalanceTransactionSource'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON BalanceTransactionSource'Variants where
  toJSON :: BalanceTransactionSource'Variants -> Value
toJSON (BalanceTransactionSource'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (BalanceTransactionSource'ApplicationFee ApplicationFee
a) = ApplicationFee -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON ApplicationFee
a
  toJSON (BalanceTransactionSource'Charge Charge
a) = Charge -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Charge
a
  toJSON (BalanceTransactionSource'ConnectCollectionTransfer ConnectCollectionTransfer
a) = ConnectCollectionTransfer -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON ConnectCollectionTransfer
a
  toJSON (BalanceTransactionSource'Dispute Dispute
a) = Dispute -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Dispute
a
  toJSON (BalanceTransactionSource'FeeRefund FeeRefund
a) = FeeRefund -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON FeeRefund
a
  toJSON (BalanceTransactionSource'Issuing'authorization Issuing'authorization
a) = Issuing'authorization -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Issuing'authorization
a
  toJSON (BalanceTransactionSource'Issuing'dispute Issuing'dispute
a) = Issuing'dispute -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Issuing'dispute
a
  toJSON (BalanceTransactionSource'Issuing'transaction Issuing'transaction
a) = Issuing'transaction -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Issuing'transaction
a
  toJSON (BalanceTransactionSource'Payout Payout
a) = Payout -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Payout
a
  toJSON (BalanceTransactionSource'PlatformTaxFee PlatformTaxFee
a) = PlatformTaxFee -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON PlatformTaxFee
a
  toJSON (BalanceTransactionSource'Refund Refund
a) = Refund -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Refund
a
  toJSON (BalanceTransactionSource'ReserveTransaction ReserveTransaction
a) = ReserveTransaction -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON ReserveTransaction
a
  toJSON (BalanceTransactionSource'TaxDeductedAtSource TaxDeductedAtSource
a) = TaxDeductedAtSource -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON TaxDeductedAtSource
a
  toJSON (BalanceTransactionSource'Topup Topup
a) = Topup -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Topup
a
  toJSON (BalanceTransactionSource'Transfer Transfer
a) = Transfer -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Transfer
a
  toJSON (BalanceTransactionSource'TransferReversal TransferReversal
a) = TransferReversal -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON TransferReversal
a

instance Data.Aeson.Types.FromJSON.FromJSON BalanceTransactionSource'Variants where
  parseJSON :: Value -> Parser BalanceTransactionSource'Variants
parseJSON Value
val = case (Text -> BalanceTransactionSource'Variants
BalanceTransactionSource'Text (Text -> BalanceTransactionSource'Variants)
-> Result Text -> Result BalanceTransactionSource'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 BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((ApplicationFee -> BalanceTransactionSource'Variants
BalanceTransactionSource'ApplicationFee (ApplicationFee -> BalanceTransactionSource'Variants)
-> Result ApplicationFee
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result ApplicationFee
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Charge -> BalanceTransactionSource'Variants
BalanceTransactionSource'Charge (Charge -> BalanceTransactionSource'Variants)
-> Result Charge -> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Charge
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((ConnectCollectionTransfer -> BalanceTransactionSource'Variants
BalanceTransactionSource'ConnectCollectionTransfer (ConnectCollectionTransfer -> BalanceTransactionSource'Variants)
-> Result ConnectCollectionTransfer
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result ConnectCollectionTransfer
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Dispute -> BalanceTransactionSource'Variants
BalanceTransactionSource'Dispute (Dispute -> BalanceTransactionSource'Variants)
-> Result Dispute -> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Dispute
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((FeeRefund -> BalanceTransactionSource'Variants
BalanceTransactionSource'FeeRefund (FeeRefund -> BalanceTransactionSource'Variants)
-> Result FeeRefund -> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result FeeRefund
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Issuing'authorization -> BalanceTransactionSource'Variants
BalanceTransactionSource'Issuing'authorization (Issuing'authorization -> BalanceTransactionSource'Variants)
-> Result Issuing'authorization
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Issuing'authorization
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Issuing'dispute -> BalanceTransactionSource'Variants
BalanceTransactionSource'Issuing'dispute (Issuing'dispute -> BalanceTransactionSource'Variants)
-> Result Issuing'dispute
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Issuing'dispute
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Issuing'transaction -> BalanceTransactionSource'Variants
BalanceTransactionSource'Issuing'transaction (Issuing'transaction -> BalanceTransactionSource'Variants)
-> Result Issuing'transaction
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Issuing'transaction
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Payout -> BalanceTransactionSource'Variants
BalanceTransactionSource'Payout (Payout -> BalanceTransactionSource'Variants)
-> Result Payout -> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Payout
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((PlatformTaxFee -> BalanceTransactionSource'Variants
BalanceTransactionSource'PlatformTaxFee (PlatformTaxFee -> BalanceTransactionSource'Variants)
-> Result PlatformTaxFee
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result PlatformTaxFee
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Refund -> BalanceTransactionSource'Variants
BalanceTransactionSource'Refund (Refund -> BalanceTransactionSource'Variants)
-> Result Refund -> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Refund
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((ReserveTransaction -> BalanceTransactionSource'Variants
BalanceTransactionSource'ReserveTransaction (ReserveTransaction -> BalanceTransactionSource'Variants)
-> Result ReserveTransaction
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result ReserveTransaction
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((TaxDeductedAtSource -> BalanceTransactionSource'Variants
BalanceTransactionSource'TaxDeductedAtSource (TaxDeductedAtSource -> BalanceTransactionSource'Variants)
-> Result TaxDeductedAtSource
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result TaxDeductedAtSource
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Topup -> BalanceTransactionSource'Variants
BalanceTransactionSource'Topup (Topup -> BalanceTransactionSource'Variants)
-> Result Topup -> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Topup
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Transfer -> BalanceTransactionSource'Variants
BalanceTransactionSource'Transfer (Transfer -> BalanceTransactionSource'Variants)
-> Result Transfer -> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Transfer
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((TransferReversal -> BalanceTransactionSource'Variants
BalanceTransactionSource'TransferReversal (TransferReversal -> BalanceTransactionSource'Variants)
-> Result TransferReversal
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result TransferReversal
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
-> Result BalanceTransactionSource'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result BalanceTransactionSource'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched")))))))))))))))) of
    Data.Aeson.Types.Internal.Success BalanceTransactionSource'Variants
a -> BalanceTransactionSource'Variants
-> Parser BalanceTransactionSource'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure BalanceTransactionSource'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser BalanceTransactionSource'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the enum schema located at @components.schemas.balance_transaction.properties.type@ in the specification.
--
-- Transaction type: \`adjustment\`, \`advance\`, \`advance_funding\`, \`anticipation_repayment\`, \`application_fee\`, \`application_fee_refund\`, \`charge\`, \`connect_collection_transfer\`, \`contribution\`, \`issuing_authorization_hold\`, \`issuing_authorization_release\`, \`issuing_dispute\`, \`issuing_transaction\`, \`payment\`, \`payment_failure_refund\`, \`payment_refund\`, \`payout\`, \`payout_cancel\`, \`payout_failure\`, \`refund\`, \`refund_failure\`, \`reserve_transaction\`, \`reserved_funds\`, \`stripe_fee\`, \`stripe_fx_fee\`, \`tax_fee\`, \`topup\`, \`topup_reversal\`, \`transfer\`, \`transfer_cancel\`, \`transfer_failure\`, or \`transfer_refund\`. [Learn more](https:\/\/stripe.com\/docs\/reports\/balance-transaction-types) about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider \`reporting_category\` instead.
data BalanceTransactionType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    BalanceTransactionType'Other Data.Aeson.Types.Internal.Value
  | -- | This constructor can be used to send values to the server which are not present in the specification yet.
    BalanceTransactionType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"adjustment"@
    BalanceTransactionType'EnumAdjustment
  | -- | Represents the JSON value @"advance"@
    BalanceTransactionType'EnumAdvance
  | -- | Represents the JSON value @"advance_funding"@
    BalanceTransactionType'EnumAdvanceFunding
  | -- | Represents the JSON value @"anticipation_repayment"@
    BalanceTransactionType'EnumAnticipationRepayment
  | -- | Represents the JSON value @"application_fee"@
    BalanceTransactionType'EnumApplicationFee
  | -- | Represents the JSON value @"application_fee_refund"@
    BalanceTransactionType'EnumApplicationFeeRefund
  | -- | Represents the JSON value @"charge"@
    BalanceTransactionType'EnumCharge
  | -- | Represents the JSON value @"connect_collection_transfer"@
    BalanceTransactionType'EnumConnectCollectionTransfer
  | -- | Represents the JSON value @"contribution"@
    BalanceTransactionType'EnumContribution
  | -- | Represents the JSON value @"issuing_authorization_hold"@
    BalanceTransactionType'EnumIssuingAuthorizationHold
  | -- | Represents the JSON value @"issuing_authorization_release"@
    BalanceTransactionType'EnumIssuingAuthorizationRelease
  | -- | Represents the JSON value @"issuing_dispute"@
    BalanceTransactionType'EnumIssuingDispute
  | -- | Represents the JSON value @"issuing_transaction"@
    BalanceTransactionType'EnumIssuingTransaction
  | -- | Represents the JSON value @"payment"@
    BalanceTransactionType'EnumPayment
  | -- | Represents the JSON value @"payment_failure_refund"@
    BalanceTransactionType'EnumPaymentFailureRefund
  | -- | Represents the JSON value @"payment_refund"@
    BalanceTransactionType'EnumPaymentRefund
  | -- | Represents the JSON value @"payout"@
    BalanceTransactionType'EnumPayout
  | -- | Represents the JSON value @"payout_cancel"@
    BalanceTransactionType'EnumPayoutCancel
  | -- | Represents the JSON value @"payout_failure"@
    BalanceTransactionType'EnumPayoutFailure
  | -- | Represents the JSON value @"refund"@
    BalanceTransactionType'EnumRefund
  | -- | Represents the JSON value @"refund_failure"@
    BalanceTransactionType'EnumRefundFailure
  | -- | Represents the JSON value @"reserve_transaction"@
    BalanceTransactionType'EnumReserveTransaction
  | -- | Represents the JSON value @"reserved_funds"@
    BalanceTransactionType'EnumReservedFunds
  | -- | Represents the JSON value @"stripe_fee"@
    BalanceTransactionType'EnumStripeFee
  | -- | Represents the JSON value @"stripe_fx_fee"@
    BalanceTransactionType'EnumStripeFxFee
  | -- | Represents the JSON value @"tax_fee"@
    BalanceTransactionType'EnumTaxFee
  | -- | Represents the JSON value @"topup"@
    BalanceTransactionType'EnumTopup
  | -- | Represents the JSON value @"topup_reversal"@
    BalanceTransactionType'EnumTopupReversal
  | -- | Represents the JSON value @"transfer"@
    BalanceTransactionType'EnumTransfer
  | -- | Represents the JSON value @"transfer_cancel"@
    BalanceTransactionType'EnumTransferCancel
  | -- | Represents the JSON value @"transfer_failure"@
    BalanceTransactionType'EnumTransferFailure
  | -- | Represents the JSON value @"transfer_refund"@
    BalanceTransactionType'EnumTransferRefund
  deriving (Int -> BalanceTransactionType' -> ShowS
[BalanceTransactionType'] -> ShowS
BalanceTransactionType' -> String
(Int -> BalanceTransactionType' -> ShowS)
-> (BalanceTransactionType' -> String)
-> ([BalanceTransactionType'] -> ShowS)
-> Show BalanceTransactionType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BalanceTransactionType'] -> ShowS
$cshowList :: [BalanceTransactionType'] -> ShowS
show :: BalanceTransactionType' -> String
$cshow :: BalanceTransactionType' -> String
showsPrec :: Int -> BalanceTransactionType' -> ShowS
$cshowsPrec :: Int -> BalanceTransactionType' -> ShowS
GHC.Show.Show, BalanceTransactionType' -> BalanceTransactionType' -> Bool
(BalanceTransactionType' -> BalanceTransactionType' -> Bool)
-> (BalanceTransactionType' -> BalanceTransactionType' -> Bool)
-> Eq BalanceTransactionType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BalanceTransactionType' -> BalanceTransactionType' -> Bool
$c/= :: BalanceTransactionType' -> BalanceTransactionType' -> Bool
== :: BalanceTransactionType' -> BalanceTransactionType' -> Bool
$c== :: BalanceTransactionType' -> BalanceTransactionType' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON BalanceTransactionType' where
  toJSON :: BalanceTransactionType' -> Value
toJSON (BalanceTransactionType'Other Value
val) = Value
val
  toJSON (BalanceTransactionType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumAdjustment) = Value
"adjustment"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumAdvance) = Value
"advance"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumAdvanceFunding) = Value
"advance_funding"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumAnticipationRepayment) = Value
"anticipation_repayment"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumApplicationFee) = Value
"application_fee"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumApplicationFeeRefund) = Value
"application_fee_refund"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumCharge) = Value
"charge"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumConnectCollectionTransfer) = Value
"connect_collection_transfer"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumContribution) = Value
"contribution"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumIssuingAuthorizationHold) = Value
"issuing_authorization_hold"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumIssuingAuthorizationRelease) = Value
"issuing_authorization_release"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumIssuingDispute) = Value
"issuing_dispute"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumIssuingTransaction) = Value
"issuing_transaction"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumPayment) = Value
"payment"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumPaymentFailureRefund) = Value
"payment_failure_refund"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumPaymentRefund) = Value
"payment_refund"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumPayout) = Value
"payout"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumPayoutCancel) = Value
"payout_cancel"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumPayoutFailure) = Value
"payout_failure"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumRefund) = Value
"refund"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumRefundFailure) = Value
"refund_failure"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumReserveTransaction) = Value
"reserve_transaction"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumReservedFunds) = Value
"reserved_funds"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumStripeFee) = Value
"stripe_fee"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumStripeFxFee) = Value
"stripe_fx_fee"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumTaxFee) = Value
"tax_fee"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumTopup) = Value
"topup"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumTopupReversal) = Value
"topup_reversal"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumTransfer) = Value
"transfer"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumTransferCancel) = Value
"transfer_cancel"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumTransferFailure) = Value
"transfer_failure"
  toJSON (BalanceTransactionType'
BalanceTransactionType'EnumTransferRefund) = Value
"transfer_refund"

instance Data.Aeson.Types.FromJSON.FromJSON BalanceTransactionType' where
  parseJSON :: Value -> Parser BalanceTransactionType'
parseJSON Value
val =
    BalanceTransactionType' -> Parser BalanceTransactionType'
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
"adjustment" -> BalanceTransactionType'
BalanceTransactionType'EnumAdjustment
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"advance" -> BalanceTransactionType'
BalanceTransactionType'EnumAdvance
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"advance_funding" -> BalanceTransactionType'
BalanceTransactionType'EnumAdvanceFunding
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"anticipation_repayment" -> BalanceTransactionType'
BalanceTransactionType'EnumAnticipationRepayment
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"application_fee" -> BalanceTransactionType'
BalanceTransactionType'EnumApplicationFee
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"application_fee_refund" -> BalanceTransactionType'
BalanceTransactionType'EnumApplicationFeeRefund
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"charge" -> BalanceTransactionType'
BalanceTransactionType'EnumCharge
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"connect_collection_transfer" -> BalanceTransactionType'
BalanceTransactionType'EnumConnectCollectionTransfer
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"contribution" -> BalanceTransactionType'
BalanceTransactionType'EnumContribution
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"issuing_authorization_hold" -> BalanceTransactionType'
BalanceTransactionType'EnumIssuingAuthorizationHold
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"issuing_authorization_release" -> BalanceTransactionType'
BalanceTransactionType'EnumIssuingAuthorizationRelease
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"issuing_dispute" -> BalanceTransactionType'
BalanceTransactionType'EnumIssuingDispute
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"issuing_transaction" -> BalanceTransactionType'
BalanceTransactionType'EnumIssuingTransaction
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"payment" -> BalanceTransactionType'
BalanceTransactionType'EnumPayment
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"payment_failure_refund" -> BalanceTransactionType'
BalanceTransactionType'EnumPaymentFailureRefund
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"payment_refund" -> BalanceTransactionType'
BalanceTransactionType'EnumPaymentRefund
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"payout" -> BalanceTransactionType'
BalanceTransactionType'EnumPayout
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"payout_cancel" -> BalanceTransactionType'
BalanceTransactionType'EnumPayoutCancel
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"payout_failure" -> BalanceTransactionType'
BalanceTransactionType'EnumPayoutFailure
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"refund" -> BalanceTransactionType'
BalanceTransactionType'EnumRefund
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"refund_failure" -> BalanceTransactionType'
BalanceTransactionType'EnumRefundFailure
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"reserve_transaction" -> BalanceTransactionType'
BalanceTransactionType'EnumReserveTransaction
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"reserved_funds" -> BalanceTransactionType'
BalanceTransactionType'EnumReservedFunds
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"stripe_fee" -> BalanceTransactionType'
BalanceTransactionType'EnumStripeFee
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"stripe_fx_fee" -> BalanceTransactionType'
BalanceTransactionType'EnumStripeFxFee
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"tax_fee" -> BalanceTransactionType'
BalanceTransactionType'EnumTaxFee
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"topup" -> BalanceTransactionType'
BalanceTransactionType'EnumTopup
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"topup_reversal" -> BalanceTransactionType'
BalanceTransactionType'EnumTopupReversal
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"transfer" -> BalanceTransactionType'
BalanceTransactionType'EnumTransfer
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"transfer_cancel" -> BalanceTransactionType'
BalanceTransactionType'EnumTransferCancel
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"transfer_failure" -> BalanceTransactionType'
BalanceTransactionType'EnumTransferFailure
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"transfer_refund" -> BalanceTransactionType'
BalanceTransactionType'EnumTransferRefund
            | Bool
GHC.Base.otherwise -> Value -> BalanceTransactionType'
BalanceTransactionType'Other Value
val
      )