{-# 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 InvoiceTransferData module StripeAPI.Types.InvoiceTransferData 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.Account import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.invoice_transfer_data@ in the specification. data InvoiceTransferData = InvoiceTransferData { -- | amount: The amount in %s that will be transferred to the destination account when the invoice is paid. By default, the entire amount is transferred to the destination. invoiceTransferDataAmount :: (GHC.Maybe.Maybe GHC.Types.Int), -- | destination: The account where funds from the payment will be transferred to upon payment success. invoiceTransferDataDestination :: InvoiceTransferDataDestination'Variants } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON InvoiceTransferData where toJSON obj = Data.Aeson.Types.Internal.object ("amount" Data.Aeson.Types.ToJSON..= invoiceTransferDataAmount obj : "destination" Data.Aeson.Types.ToJSON..= invoiceTransferDataDestination obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("amount" Data.Aeson.Types.ToJSON..= invoiceTransferDataAmount obj) GHC.Base.<> ("destination" Data.Aeson.Types.ToJSON..= invoiceTransferDataDestination obj)) instance Data.Aeson.Types.FromJSON.FromJSON InvoiceTransferData where parseJSON = Data.Aeson.Types.FromJSON.withObject "InvoiceTransferData" (\obj -> (GHC.Base.pure InvoiceTransferData GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "destination")) -- | Create a new 'InvoiceTransferData' with all required fields. mkInvoiceTransferData :: -- | 'invoiceTransferDataDestination' InvoiceTransferDataDestination'Variants -> InvoiceTransferData mkInvoiceTransferData invoiceTransferDataDestination = InvoiceTransferData { invoiceTransferDataAmount = GHC.Maybe.Nothing, invoiceTransferDataDestination = invoiceTransferDataDestination } -- | Defines the oneOf schema located at @components.schemas.invoice_transfer_data.properties.destination.anyOf@ in the specification. -- -- The account where funds from the payment will be transferred to upon payment success. data InvoiceTransferDataDestination'Variants = InvoiceTransferDataDestination'Text Data.Text.Internal.Text | InvoiceTransferDataDestination'Account Account deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON InvoiceTransferDataDestination'Variants where toJSON (InvoiceTransferDataDestination'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (InvoiceTransferDataDestination'Account a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON InvoiceTransferDataDestination'Variants where parseJSON val = case (InvoiceTransferDataDestination'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((InvoiceTransferDataDestination'Account 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