{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.CreditNoteLineItem 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.CreditNoteTaxAmount
import {-# SOURCE #-} StripeAPI.Types.DiscountsResourceDiscountAmount
import {-# SOURCE #-} StripeAPI.Types.TaxRate
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data CreditNoteLineItem = CreditNoteLineItem
{
CreditNoteLineItem -> Int
creditNoteLineItemAmount :: GHC.Types.Int,
CreditNoteLineItem -> Maybe Text
creditNoteLineItemDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
CreditNoteLineItem -> Int
creditNoteLineItemDiscountAmount :: GHC.Types.Int,
CreditNoteLineItem -> [DiscountsResourceDiscountAmount]
creditNoteLineItemDiscountAmounts :: ([DiscountsResourceDiscountAmount]),
CreditNoteLineItem -> Text
creditNoteLineItemId :: Data.Text.Internal.Text,
CreditNoteLineItem -> Maybe Text
creditNoteLineItemInvoiceLineItem :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
CreditNoteLineItem -> Bool
creditNoteLineItemLivemode :: GHC.Types.Bool,
CreditNoteLineItem -> Maybe Int
creditNoteLineItemQuantity :: (GHC.Maybe.Maybe GHC.Types.Int),
CreditNoteLineItem -> [CreditNoteTaxAmount]
creditNoteLineItemTaxAmounts :: ([CreditNoteTaxAmount]),
CreditNoteLineItem -> [TaxRate]
creditNoteLineItemTaxRates :: ([TaxRate]),
CreditNoteLineItem -> CreditNoteLineItemType'
creditNoteLineItemType :: CreditNoteLineItemType',
CreditNoteLineItem -> Maybe Int
creditNoteLineItemUnitAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
CreditNoteLineItem -> Maybe Text
creditNoteLineItemUnitAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> CreditNoteLineItem -> ShowS
[CreditNoteLineItem] -> ShowS
CreditNoteLineItem -> String
(Int -> CreditNoteLineItem -> ShowS)
-> (CreditNoteLineItem -> String)
-> ([CreditNoteLineItem] -> ShowS)
-> Show CreditNoteLineItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditNoteLineItem] -> ShowS
$cshowList :: [CreditNoteLineItem] -> ShowS
show :: CreditNoteLineItem -> String
$cshow :: CreditNoteLineItem -> String
showsPrec :: Int -> CreditNoteLineItem -> ShowS
$cshowsPrec :: Int -> CreditNoteLineItem -> ShowS
GHC.Show.Show,
CreditNoteLineItem -> CreditNoteLineItem -> Bool
(CreditNoteLineItem -> CreditNoteLineItem -> Bool)
-> (CreditNoteLineItem -> CreditNoteLineItem -> Bool)
-> Eq CreditNoteLineItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditNoteLineItem -> CreditNoteLineItem -> Bool
$c/= :: CreditNoteLineItem -> CreditNoteLineItem -> Bool
== :: CreditNoteLineItem -> CreditNoteLineItem -> Bool
$c== :: CreditNoteLineItem -> CreditNoteLineItem -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteLineItem where
toJSON :: CreditNoteLineItem -> Value
toJSON CreditNoteLineItem
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..= CreditNoteLineItem -> Int
creditNoteLineItemAmount CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"description" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Maybe Text
creditNoteLineItemDescription CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"discount_amount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Int
creditNoteLineItemDiscountAmount CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"discount_amounts" Text -> [DiscountsResourceDiscountAmount] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> [DiscountsResourceDiscountAmount]
creditNoteLineItemDiscountAmounts CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Text
creditNoteLineItemId CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"invoice_line_item" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Maybe Text
creditNoteLineItemInvoiceLineItem CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"livemode" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Bool
creditNoteLineItemLivemode CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"quantity" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Maybe Int
creditNoteLineItemQuantity CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_amounts" Text -> [CreditNoteTaxAmount] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> [CreditNoteTaxAmount]
creditNoteLineItemTaxAmounts CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_rates" Text -> [TaxRate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> [TaxRate]
creditNoteLineItemTaxRates CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> CreditNoteLineItemType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> CreditNoteLineItemType'
creditNoteLineItemType CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"unit_amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Maybe Int
creditNoteLineItemUnitAmount CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"unit_amount_decimal" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Maybe Text
creditNoteLineItemUnitAmountDecimal CreditNoteLineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"credit_note_line_item" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: CreditNoteLineItem -> Encoding
toEncoding CreditNoteLineItem
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..= CreditNoteLineItem -> Int
creditNoteLineItemAmount CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"description" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Maybe Text
creditNoteLineItemDescription CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"discount_amount" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Int
creditNoteLineItemDiscountAmount CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"discount_amounts" Text -> [DiscountsResourceDiscountAmount] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> [DiscountsResourceDiscountAmount]
creditNoteLineItemDiscountAmounts CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"id" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Text
creditNoteLineItemId CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"invoice_line_item" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Maybe Text
creditNoteLineItemInvoiceLineItem CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"livemode" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Bool
creditNoteLineItemLivemode CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"quantity" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Maybe Int
creditNoteLineItemQuantity CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tax_amounts" Text -> [CreditNoteTaxAmount] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> [CreditNoteTaxAmount]
creditNoteLineItemTaxAmounts CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tax_rates" Text -> [TaxRate] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> [TaxRate]
creditNoteLineItemTaxRates CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"type" Text -> CreditNoteLineItemType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> CreditNoteLineItemType'
creditNoteLineItemType CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"unit_amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Maybe Int
creditNoteLineItemUnitAmount CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"unit_amount_decimal" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLineItem -> Maybe Text
creditNoteLineItemUnitAmountDecimal CreditNoteLineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"credit_note_line_item"))))))))))))))
instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteLineItem where
parseJSON :: Value -> Parser CreditNoteLineItem
parseJSON = String
-> (Object -> Parser CreditNoteLineItem)
-> Value
-> Parser CreditNoteLineItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"CreditNoteLineItem" (\Object
obj -> (((((((((((((Int
-> Maybe Text
-> Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
-> Parser
(Int
-> Maybe Text
-> Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Int
-> Maybe Text
-> Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem
CreditNoteLineItem Parser
(Int
-> Maybe Text
-> Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
-> Parser Int
-> Parser
(Maybe Text
-> Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
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
(Maybe Text
-> Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
-> Parser (Maybe Text)
-> Parser
(Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
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
"description")) Parser
(Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
-> Parser Int
-> Parser
([DiscountsResourceDiscountAmount]
-> Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
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
"discount_amount")) Parser
([DiscountsResourceDiscountAmount]
-> Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
-> Parser [DiscountsResourceDiscountAmount]
-> Parser
(Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser [DiscountsResourceDiscountAmount]
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"discount_amounts")) Parser
(Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
-> Parser Text
-> Parser
(Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"id")) Parser
(Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
-> Parser (Maybe Text)
-> Parser
(Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
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
"invoice_line_item")) Parser
(Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
-> Parser Bool
-> Parser
(Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
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
"livemode")) Parser
(Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
-> Parser (Maybe Int)
-> Parser
([CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"quantity")) Parser
([CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
-> Parser [CreditNoteTaxAmount]
-> Parser
([TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser [CreditNoteTaxAmount]
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"tax_amounts")) Parser
([TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem)
-> Parser [TaxRate]
-> Parser
(CreditNoteLineItemType'
-> Maybe Int -> Maybe Text -> CreditNoteLineItem)
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
"tax_rates")) Parser
(CreditNoteLineItemType'
-> Maybe Int -> Maybe Text -> CreditNoteLineItem)
-> Parser CreditNoteLineItemType'
-> Parser (Maybe Int -> Maybe Text -> CreditNoteLineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser CreditNoteLineItemType'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"type")) Parser (Maybe Int -> Maybe Text -> CreditNoteLineItem)
-> Parser (Maybe Int) -> Parser (Maybe Text -> CreditNoteLineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"unit_amount")) Parser (Maybe Text -> CreditNoteLineItem)
-> Parser (Maybe Text) -> Parser CreditNoteLineItem
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
"unit_amount_decimal"))
mkCreditNoteLineItem ::
GHC.Types.Int ->
GHC.Types.Int ->
[DiscountsResourceDiscountAmount] ->
Data.Text.Internal.Text ->
GHC.Types.Bool ->
[CreditNoteTaxAmount] ->
[TaxRate] ->
CreditNoteLineItemType' ->
CreditNoteLineItem
mkCreditNoteLineItem :: Int
-> Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> Bool
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> CreditNoteLineItem
mkCreditNoteLineItem Int
creditNoteLineItemAmount Int
creditNoteLineItemDiscountAmount [DiscountsResourceDiscountAmount]
creditNoteLineItemDiscountAmounts Text
creditNoteLineItemId Bool
creditNoteLineItemLivemode [CreditNoteTaxAmount]
creditNoteLineItemTaxAmounts [TaxRate]
creditNoteLineItemTaxRates CreditNoteLineItemType'
creditNoteLineItemType =
CreditNoteLineItem :: Int
-> Maybe Text
-> Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> Maybe Text
-> Bool
-> Maybe Int
-> [CreditNoteTaxAmount]
-> [TaxRate]
-> CreditNoteLineItemType'
-> Maybe Int
-> Maybe Text
-> CreditNoteLineItem
CreditNoteLineItem
{ creditNoteLineItemAmount :: Int
creditNoteLineItemAmount = Int
creditNoteLineItemAmount,
creditNoteLineItemDescription :: Maybe Text
creditNoteLineItemDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
creditNoteLineItemDiscountAmount :: Int
creditNoteLineItemDiscountAmount = Int
creditNoteLineItemDiscountAmount,
creditNoteLineItemDiscountAmounts :: [DiscountsResourceDiscountAmount]
creditNoteLineItemDiscountAmounts = [DiscountsResourceDiscountAmount]
creditNoteLineItemDiscountAmounts,
creditNoteLineItemId :: Text
creditNoteLineItemId = Text
creditNoteLineItemId,
creditNoteLineItemInvoiceLineItem :: Maybe Text
creditNoteLineItemInvoiceLineItem = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
creditNoteLineItemLivemode :: Bool
creditNoteLineItemLivemode = Bool
creditNoteLineItemLivemode,
creditNoteLineItemQuantity :: Maybe Int
creditNoteLineItemQuantity = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
creditNoteLineItemTaxAmounts :: [CreditNoteTaxAmount]
creditNoteLineItemTaxAmounts = [CreditNoteTaxAmount]
creditNoteLineItemTaxAmounts,
creditNoteLineItemTaxRates :: [TaxRate]
creditNoteLineItemTaxRates = [TaxRate]
creditNoteLineItemTaxRates,
creditNoteLineItemType :: CreditNoteLineItemType'
creditNoteLineItemType = CreditNoteLineItemType'
creditNoteLineItemType,
creditNoteLineItemUnitAmount :: Maybe Int
creditNoteLineItemUnitAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
creditNoteLineItemUnitAmountDecimal :: Maybe Text
creditNoteLineItemUnitAmountDecimal = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}
data CreditNoteLineItemType'
=
CreditNoteLineItemType'Other Data.Aeson.Types.Internal.Value
|
CreditNoteLineItemType'Typed Data.Text.Internal.Text
|
CreditNoteLineItemType'EnumCustomLineItem
|
CreditNoteLineItemType'EnumInvoiceLineItem
deriving (Int -> CreditNoteLineItemType' -> ShowS
[CreditNoteLineItemType'] -> ShowS
CreditNoteLineItemType' -> String
(Int -> CreditNoteLineItemType' -> ShowS)
-> (CreditNoteLineItemType' -> String)
-> ([CreditNoteLineItemType'] -> ShowS)
-> Show CreditNoteLineItemType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditNoteLineItemType'] -> ShowS
$cshowList :: [CreditNoteLineItemType'] -> ShowS
show :: CreditNoteLineItemType' -> String
$cshow :: CreditNoteLineItemType' -> String
showsPrec :: Int -> CreditNoteLineItemType' -> ShowS
$cshowsPrec :: Int -> CreditNoteLineItemType' -> ShowS
GHC.Show.Show, CreditNoteLineItemType' -> CreditNoteLineItemType' -> Bool
(CreditNoteLineItemType' -> CreditNoteLineItemType' -> Bool)
-> (CreditNoteLineItemType' -> CreditNoteLineItemType' -> Bool)
-> Eq CreditNoteLineItemType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditNoteLineItemType' -> CreditNoteLineItemType' -> Bool
$c/= :: CreditNoteLineItemType' -> CreditNoteLineItemType' -> Bool
== :: CreditNoteLineItemType' -> CreditNoteLineItemType' -> Bool
$c== :: CreditNoteLineItemType' -> CreditNoteLineItemType' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteLineItemType' where
toJSON :: CreditNoteLineItemType' -> Value
toJSON (CreditNoteLineItemType'Other Value
val) = Value
val
toJSON (CreditNoteLineItemType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (CreditNoteLineItemType'
CreditNoteLineItemType'EnumCustomLineItem) = Value
"custom_line_item"
toJSON (CreditNoteLineItemType'
CreditNoteLineItemType'EnumInvoiceLineItem) = Value
"invoice_line_item"
instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteLineItemType' where
parseJSON :: Value -> Parser CreditNoteLineItemType'
parseJSON Value
val =
CreditNoteLineItemType' -> Parser CreditNoteLineItemType'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"custom_line_item" -> CreditNoteLineItemType'
CreditNoteLineItemType'EnumCustomLineItem
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"invoice_line_item" -> CreditNoteLineItemType'
CreditNoteLineItemType'EnumInvoiceLineItem
| Bool
GHC.Base.otherwise -> Value -> CreditNoteLineItemType'
CreditNoteLineItemType'Other Value
val
)