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