{-# 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 FeeRefund module StripeAPI.Types.FeeRefund 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.BalanceTransaction import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.fee_refund@ in the specification. -- -- \`Application Fee Refund\` objects allow you to refund an application fee that -- has previously been created but not yet refunded. Funds will be refunded to -- the Stripe account from which the fee was originally collected. -- -- Related guide: [Refunding Application Fees](https:\/\/stripe.com\/docs\/connect\/destination-charges\#refunding-app-fee). data FeeRefund = FeeRefund { -- | amount: Amount, in %s. feeRefundAmount :: GHC.Types.Int, -- | balance_transaction: Balance transaction that describes the impact on your account balance. feeRefundBalanceTransaction :: (GHC.Maybe.Maybe FeeRefundBalanceTransaction'Variants), -- | created: Time at which the object was created. Measured in seconds since the Unix epoch. feeRefundCreated :: 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). feeRefundCurrency :: Data.Text.Internal.Text, -- | fee: ID of the application fee that was refunded. feeRefundFee :: FeeRefundFee'Variants, -- | id: Unique identifier for the object. -- -- Constraints: -- -- * Maximum length of 5000 feeRefundId :: Data.Text.Internal.Text, -- | metadata: Set of [key-value pairs](https:\/\/stripe.com\/docs\/api\/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. feeRefundMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON FeeRefund where toJSON obj = Data.Aeson.Types.Internal.object ("amount" Data.Aeson.Types.ToJSON..= feeRefundAmount obj : "balance_transaction" Data.Aeson.Types.ToJSON..= feeRefundBalanceTransaction obj : "created" Data.Aeson.Types.ToJSON..= feeRefundCreated obj : "currency" Data.Aeson.Types.ToJSON..= feeRefundCurrency obj : "fee" Data.Aeson.Types.ToJSON..= feeRefundFee obj : "id" Data.Aeson.Types.ToJSON..= feeRefundId obj : "metadata" Data.Aeson.Types.ToJSON..= feeRefundMetadata obj : "object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "fee_refund" : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("amount" Data.Aeson.Types.ToJSON..= feeRefundAmount obj) GHC.Base.<> (("balance_transaction" Data.Aeson.Types.ToJSON..= feeRefundBalanceTransaction obj) GHC.Base.<> (("created" Data.Aeson.Types.ToJSON..= feeRefundCreated obj) GHC.Base.<> (("currency" Data.Aeson.Types.ToJSON..= feeRefundCurrency obj) GHC.Base.<> (("fee" Data.Aeson.Types.ToJSON..= feeRefundFee obj) GHC.Base.<> (("id" Data.Aeson.Types.ToJSON..= feeRefundId obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= feeRefundMetadata obj) GHC.Base.<> ("object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "fee_refund")))))))) instance Data.Aeson.Types.FromJSON.FromJSON FeeRefund where parseJSON = Data.Aeson.Types.FromJSON.withObject "FeeRefund" (\obj -> ((((((GHC.Base.pure FeeRefund GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "balance_transaction")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "created")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "fee")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "id")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "metadata")) -- | Create a new 'FeeRefund' with all required fields. mkFeeRefund :: -- | 'feeRefundAmount' GHC.Types.Int -> -- | 'feeRefundCreated' GHC.Types.Int -> -- | 'feeRefundCurrency' Data.Text.Internal.Text -> -- | 'feeRefundFee' FeeRefundFee'Variants -> -- | 'feeRefundId' Data.Text.Internal.Text -> FeeRefund mkFeeRefund feeRefundAmount feeRefundCreated feeRefundCurrency feeRefundFee feeRefundId = FeeRefund { feeRefundAmount = feeRefundAmount, feeRefundBalanceTransaction = GHC.Maybe.Nothing, feeRefundCreated = feeRefundCreated, feeRefundCurrency = feeRefundCurrency, feeRefundFee = feeRefundFee, feeRefundId = feeRefundId, feeRefundMetadata = GHC.Maybe.Nothing } -- | Defines the oneOf schema located at @components.schemas.fee_refund.properties.balance_transaction.anyOf@ in the specification. -- -- Balance transaction that describes the impact on your account balance. data FeeRefundBalanceTransaction'Variants = FeeRefundBalanceTransaction'Text Data.Text.Internal.Text | FeeRefundBalanceTransaction'BalanceTransaction BalanceTransaction deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON FeeRefundBalanceTransaction'Variants where toJSON (FeeRefundBalanceTransaction'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (FeeRefundBalanceTransaction'BalanceTransaction a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON FeeRefundBalanceTransaction'Variants where parseJSON val = case (FeeRefundBalanceTransaction'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((FeeRefundBalanceTransaction'BalanceTransaction Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched") of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | Defines the oneOf schema located at @components.schemas.fee_refund.properties.fee.anyOf@ in the specification. -- -- ID of the application fee that was refunded. data FeeRefundFee'Variants = FeeRefundFee'Text Data.Text.Internal.Text | FeeRefundFee'ApplicationFee ApplicationFee deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON FeeRefundFee'Variants where toJSON (FeeRefundFee'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (FeeRefundFee'ApplicationFee a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON FeeRefundFee'Variants where parseJSON val = case (FeeRefundFee'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((FeeRefundFee'ApplicationFee Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched") of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a