{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.AccountPayoutSettings 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.TransferSchedule
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data AccountPayoutSettings = AccountPayoutSettings
{
AccountPayoutSettings -> Bool
accountPayoutSettingsDebitNegativeBalances :: GHC.Types.Bool,
AccountPayoutSettings -> TransferSchedule
accountPayoutSettingsSchedule :: TransferSchedule,
AccountPayoutSettings -> Maybe Text
accountPayoutSettingsStatementDescriptor :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> AccountPayoutSettings -> ShowS
[AccountPayoutSettings] -> ShowS
AccountPayoutSettings -> String
(Int -> AccountPayoutSettings -> ShowS)
-> (AccountPayoutSettings -> String)
-> ([AccountPayoutSettings] -> ShowS)
-> Show AccountPayoutSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountPayoutSettings] -> ShowS
$cshowList :: [AccountPayoutSettings] -> ShowS
show :: AccountPayoutSettings -> String
$cshow :: AccountPayoutSettings -> String
showsPrec :: Int -> AccountPayoutSettings -> ShowS
$cshowsPrec :: Int -> AccountPayoutSettings -> ShowS
GHC.Show.Show,
AccountPayoutSettings -> AccountPayoutSettings -> Bool
(AccountPayoutSettings -> AccountPayoutSettings -> Bool)
-> (AccountPayoutSettings -> AccountPayoutSettings -> Bool)
-> Eq AccountPayoutSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountPayoutSettings -> AccountPayoutSettings -> Bool
$c/= :: AccountPayoutSettings -> AccountPayoutSettings -> Bool
== :: AccountPayoutSettings -> AccountPayoutSettings -> Bool
$c== :: AccountPayoutSettings -> AccountPayoutSettings -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON AccountPayoutSettings where
toJSON :: AccountPayoutSettings -> Value
toJSON AccountPayoutSettings
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"debit_negative_balances" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountPayoutSettings -> Bool
accountPayoutSettingsDebitNegativeBalances AccountPayoutSettings
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"schedule" Text -> TransferSchedule -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountPayoutSettings -> TransferSchedule
accountPayoutSettingsSchedule AccountPayoutSettings
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..= AccountPayoutSettings -> Maybe Text
accountPayoutSettingsStatementDescriptor AccountPayoutSettings
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: AccountPayoutSettings -> Encoding
toEncoding AccountPayoutSettings
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"debit_negative_balances" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountPayoutSettings -> Bool
accountPayoutSettingsDebitNegativeBalances AccountPayoutSettings
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"schedule" Text -> TransferSchedule -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountPayoutSettings -> TransferSchedule
accountPayoutSettingsSchedule AccountPayoutSettings
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..= AccountPayoutSettings -> Maybe Text
accountPayoutSettingsStatementDescriptor AccountPayoutSettings
obj)))
instance Data.Aeson.Types.FromJSON.FromJSON AccountPayoutSettings where
parseJSON :: Value -> Parser AccountPayoutSettings
parseJSON = String
-> (Object -> Parser AccountPayoutSettings)
-> Value
-> Parser AccountPayoutSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"AccountPayoutSettings" (\Object
obj -> (((Bool -> TransferSchedule -> Maybe Text -> AccountPayoutSettings)
-> Parser
(Bool -> TransferSchedule -> Maybe Text -> AccountPayoutSettings)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Bool -> TransferSchedule -> Maybe Text -> AccountPayoutSettings
AccountPayoutSettings Parser
(Bool -> TransferSchedule -> Maybe Text -> AccountPayoutSettings)
-> Parser Bool
-> Parser (TransferSchedule -> Maybe Text -> AccountPayoutSettings)
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
"debit_negative_balances")) Parser (TransferSchedule -> Maybe Text -> AccountPayoutSettings)
-> Parser TransferSchedule
-> Parser (Maybe Text -> AccountPayoutSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser TransferSchedule
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"schedule")) Parser (Maybe Text -> AccountPayoutSettings)
-> Parser (Maybe Text) -> Parser AccountPayoutSettings
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"))
mkAccountPayoutSettings ::
GHC.Types.Bool ->
TransferSchedule ->
AccountPayoutSettings
mkAccountPayoutSettings :: Bool -> TransferSchedule -> AccountPayoutSettings
mkAccountPayoutSettings Bool
accountPayoutSettingsDebitNegativeBalances TransferSchedule
accountPayoutSettingsSchedule =
AccountPayoutSettings :: Bool -> TransferSchedule -> Maybe Text -> AccountPayoutSettings
AccountPayoutSettings
{ accountPayoutSettingsDebitNegativeBalances :: Bool
accountPayoutSettingsDebitNegativeBalances = Bool
accountPayoutSettingsDebitNegativeBalances,
accountPayoutSettingsSchedule :: TransferSchedule
accountPayoutSettingsSchedule = TransferSchedule
accountPayoutSettingsSchedule,
accountPayoutSettingsStatementDescriptor :: Maybe Text
accountPayoutSettingsStatementDescriptor = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}