{-# 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 ReceivedCreditsResourceTreasurySourceFlowsDetails module StripeAPI.Types.ReceivedCreditsResourceTreasurySourceFlowsDetails 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.Foldable import qualified Data.Functor import qualified Data.Maybe 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.Payout import {-# SOURCE #-} StripeAPI.Types.Treasury_CreditReversal import {-# SOURCE #-} StripeAPI.Types.Treasury_OutboundPayment import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.received_credits_resource_treasury_source_flows_details@ in the specification. data ReceivedCreditsResourceTreasurySourceFlowsDetails = ReceivedCreditsResourceTreasurySourceFlowsDetails { -- | credit_reversal: You can reverse some [ReceivedCredits](https:\/\/stripe.com\/docs\/api\#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal. receivedCreditsResourceTreasurySourceFlowsDetailsCreditReversal :: (GHC.Maybe.Maybe Treasury'creditReversal), -- | outbound_payment: Use OutboundPayments to send funds to another party\'s external bank account or [FinancialAccount](https:\/\/stripe.com\/docs\/api\#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https:\/\/stripe.com\/docs\/api\#outbound_transfers). -- -- Simulate OutboundPayment state changes with the \`\/v1\/test_helpers\/treasury\/outbound_payments\` endpoints. These methods can only be called on test mode objects. receivedCreditsResourceTreasurySourceFlowsDetailsOutboundPayment :: (GHC.Maybe.Maybe Treasury'outboundPayment), -- | payout: A \`Payout\` object is created when you receive funds from Stripe, or when you -- initiate a payout to either a bank account or debit card of a [connected -- Stripe account](\/docs\/connect\/bank-debit-card-payouts). You can retrieve individual payouts, -- as well as list all payouts. Payouts are made on [varying -- schedules](\/docs\/connect\/manage-payout-schedule), depending on your country and -- industry. -- -- Related guide: [Receiving Payouts](https:\/\/stripe.com\/docs\/payouts). receivedCreditsResourceTreasurySourceFlowsDetailsPayout :: (GHC.Maybe.Maybe Payout), -- | type: The type of the source flow that originated the ReceivedCredit. receivedCreditsResourceTreasurySourceFlowsDetailsType :: ReceivedCreditsResourceTreasurySourceFlowsDetailsType' } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON ReceivedCreditsResourceTreasurySourceFlowsDetails where toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("credit_reversal" Data.Aeson.Types.ToJSON..=)) (receivedCreditsResourceTreasurySourceFlowsDetailsCreditReversal obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("outbound_payment" Data.Aeson.Types.ToJSON..=)) (receivedCreditsResourceTreasurySourceFlowsDetailsOutboundPayment obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("payout" Data.Aeson.Types.ToJSON..=)) (receivedCreditsResourceTreasurySourceFlowsDetailsPayout obj) : ["type" Data.Aeson.Types.ToJSON..= receivedCreditsResourceTreasurySourceFlowsDetailsType obj] : GHC.Base.mempty)) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("credit_reversal" Data.Aeson.Types.ToJSON..=)) (receivedCreditsResourceTreasurySourceFlowsDetailsCreditReversal obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("outbound_payment" Data.Aeson.Types.ToJSON..=)) (receivedCreditsResourceTreasurySourceFlowsDetailsOutboundPayment obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("payout" Data.Aeson.Types.ToJSON..=)) (receivedCreditsResourceTreasurySourceFlowsDetailsPayout obj) : ["type" Data.Aeson.Types.ToJSON..= receivedCreditsResourceTreasurySourceFlowsDetailsType obj] : GHC.Base.mempty))) instance Data.Aeson.Types.FromJSON.FromJSON ReceivedCreditsResourceTreasurySourceFlowsDetails where parseJSON = Data.Aeson.Types.FromJSON.withObject "ReceivedCreditsResourceTreasurySourceFlowsDetails" (\obj -> (((GHC.Base.pure ReceivedCreditsResourceTreasurySourceFlowsDetails GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "credit_reversal")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "outbound_payment")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "payout")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "type")) -- | Create a new 'ReceivedCreditsResourceTreasurySourceFlowsDetails' with all required fields. mkReceivedCreditsResourceTreasurySourceFlowsDetails :: -- | 'receivedCreditsResourceTreasurySourceFlowsDetailsType' ReceivedCreditsResourceTreasurySourceFlowsDetailsType' -> ReceivedCreditsResourceTreasurySourceFlowsDetails mkReceivedCreditsResourceTreasurySourceFlowsDetails receivedCreditsResourceTreasurySourceFlowsDetailsType = ReceivedCreditsResourceTreasurySourceFlowsDetails { receivedCreditsResourceTreasurySourceFlowsDetailsCreditReversal = GHC.Maybe.Nothing, receivedCreditsResourceTreasurySourceFlowsDetailsOutboundPayment = GHC.Maybe.Nothing, receivedCreditsResourceTreasurySourceFlowsDetailsPayout = GHC.Maybe.Nothing, receivedCreditsResourceTreasurySourceFlowsDetailsType = receivedCreditsResourceTreasurySourceFlowsDetailsType } -- | Defines the enum schema located at @components.schemas.received_credits_resource_treasury_source_flows_details.properties.type@ in the specification. -- -- The type of the source flow that originated the ReceivedCredit. data ReceivedCreditsResourceTreasurySourceFlowsDetailsType' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. ReceivedCreditsResourceTreasurySourceFlowsDetailsType'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. ReceivedCreditsResourceTreasurySourceFlowsDetailsType'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"credit_reversal"@ ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumCreditReversal | -- | Represents the JSON value @"other"@ ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumOther | -- | Represents the JSON value @"outbound_payment"@ ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumOutboundPayment | -- | Represents the JSON value @"payout"@ ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumPayout deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ReceivedCreditsResourceTreasurySourceFlowsDetailsType' where toJSON (ReceivedCreditsResourceTreasurySourceFlowsDetailsType'Other val) = val toJSON (ReceivedCreditsResourceTreasurySourceFlowsDetailsType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumCreditReversal) = "credit_reversal" toJSON (ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumOther) = "other" toJSON (ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumOutboundPayment) = "outbound_payment" toJSON (ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumPayout) = "payout" instance Data.Aeson.Types.FromJSON.FromJSON ReceivedCreditsResourceTreasurySourceFlowsDetailsType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "credit_reversal" -> ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumCreditReversal | val GHC.Classes.== "other" -> ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumOther | val GHC.Classes.== "outbound_payment" -> ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumOutboundPayment | val GHC.Classes.== "payout" -> ReceivedCreditsResourceTreasurySourceFlowsDetailsType'EnumPayout | GHC.Base.otherwise -> ReceivedCreditsResourceTreasurySourceFlowsDetailsType'Other val )