{-# 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 CreditNote
module StripeAPI.Types.CreditNote 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.CreditNoteLineItem
import {-# SOURCE #-} StripeAPI.Types.CreditNoteTaxAmount
import {-# SOURCE #-} StripeAPI.Types.Customer
import {-# SOURCE #-} StripeAPI.Types.CustomerBalanceTransaction
import {-# SOURCE #-} StripeAPI.Types.DeletedCustomer
import {-# SOURCE #-} StripeAPI.Types.DiscountsResourceDiscountAmount
import {-# SOURCE #-} StripeAPI.Types.Invoice
import {-# SOURCE #-} StripeAPI.Types.Refund
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.credit_note@ in the specification.
--
-- Issue a credit note to adjust an invoice\'s amount after the invoice is finalized.
--
-- Related guide: [Credit Notes](https:\/\/stripe.com\/docs\/billing\/invoices\/credit-notes).
data CreditNote = CreditNote
  { -- | amount: The integer amount in %s representing the total amount of the credit note, including tax.
    CreditNote -> Int
creditNoteAmount :: GHC.Types.Int,
    -- | created: Time at which the object was created. Measured in seconds since the Unix epoch.
    CreditNote -> Int
creditNoteCreated :: GHC.Types.Int,
    -- | currency: Three-letter [ISO currency code](https:\/\/www.iso.org\/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https:\/\/stripe.com\/docs\/currencies).
    CreditNote -> Text
creditNoteCurrency :: Data.Text.Internal.Text,
    -- | customer: ID of the customer.
    CreditNote -> CreditNoteCustomer'Variants
creditNoteCustomer :: CreditNoteCustomer'Variants,
    -- | customer_balance_transaction: Customer balance transaction related to this credit note.
    CreditNote -> Maybe CreditNoteCustomerBalanceTransaction'Variants
creditNoteCustomerBalanceTransaction :: (GHC.Maybe.Maybe CreditNoteCustomerBalanceTransaction'Variants),
    -- | discount_amount: The integer amount in %s representing the total amount of discount that was credited.
    CreditNote -> Int
creditNoteDiscountAmount :: GHC.Types.Int,
    -- | discount_amounts: The aggregate amounts calculated per discount for all line items.
    CreditNote -> [DiscountsResourceDiscountAmount]
creditNoteDiscountAmounts :: ([DiscountsResourceDiscountAmount]),
    -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    CreditNote -> Text
creditNoteId :: Data.Text.Internal.Text,
    -- | invoice: ID of the invoice.
    CreditNote -> CreditNoteInvoice'Variants
creditNoteInvoice :: CreditNoteInvoice'Variants,
    -- | lines: Line items that make up the credit note
    CreditNote -> CreditNoteLines'
creditNoteLines :: CreditNoteLines',
    -- | livemode: Has the value \`true\` if the object exists in live mode or the value \`false\` if the object exists in test mode.
    CreditNote -> Bool
creditNoteLivemode :: GHC.Types.Bool,
    -- | memo: Customer-facing text that appears on the credit note PDF.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    CreditNote -> Maybe Text
creditNoteMemo :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | metadata: Set of [key-value pairs](https:\/\/stripe.com\/docs\/api\/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    CreditNote -> Maybe Object
creditNoteMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
    -- | number: A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    CreditNote -> Text
creditNoteNumber :: Data.Text.Internal.Text,
    -- | out_of_band_amount: Amount that was credited outside of Stripe.
    CreditNote -> Maybe Int
creditNoteOutOfBandAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | pdf: The link to download the PDF of the credit note.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    CreditNote -> Text
creditNotePdf :: Data.Text.Internal.Text,
    -- | reason: Reason for issuing this credit note, one of \`duplicate\`, \`fraudulent\`, \`order_change\`, or \`product_unsatisfactory\`
    CreditNote -> Maybe CreditNoteReason'
creditNoteReason :: (GHC.Maybe.Maybe CreditNoteReason'),
    -- | refund: Refund related to this credit note.
    CreditNote -> Maybe CreditNoteRefund'Variants
creditNoteRefund :: (GHC.Maybe.Maybe CreditNoteRefund'Variants),
    -- | status: Status of this credit note, one of \`issued\` or \`void\`. Learn more about [voiding credit notes](https:\/\/stripe.com\/docs\/billing\/invoices\/credit-notes\#voiding).
    CreditNote -> CreditNoteStatus'
creditNoteStatus :: CreditNoteStatus',
    -- | subtotal: The integer amount in %s representing the amount of the credit note, excluding tax and invoice level discounts.
    CreditNote -> Int
creditNoteSubtotal :: GHC.Types.Int,
    -- | tax_amounts: The aggregate amounts calculated per tax rate for all line items.
    CreditNote -> [CreditNoteTaxAmount]
creditNoteTaxAmounts :: ([CreditNoteTaxAmount]),
    -- | total: The integer amount in %s representing the total amount of the credit note, including tax and all discount.
    CreditNote -> Int
creditNoteTotal :: GHC.Types.Int,
    -- | type: Type of this credit note, one of \`pre_payment\` or \`post_payment\`. A \`pre_payment\` credit note means it was issued when the invoice was open. A \`post_payment\` credit note means it was issued when the invoice was paid.
    CreditNote -> CreditNoteType'
creditNoteType :: CreditNoteType',
    -- | voided_at: The time that the credit note was voided.
    CreditNote -> Maybe Int
creditNoteVoidedAt :: (GHC.Maybe.Maybe GHC.Types.Int)
  }
  deriving
    ( Int -> CreditNote -> ShowS
[CreditNote] -> ShowS
CreditNote -> String
(Int -> CreditNote -> ShowS)
-> (CreditNote -> String)
-> ([CreditNote] -> ShowS)
-> Show CreditNote
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditNote] -> ShowS
$cshowList :: [CreditNote] -> ShowS
show :: CreditNote -> String
$cshow :: CreditNote -> String
showsPrec :: Int -> CreditNote -> ShowS
$cshowsPrec :: Int -> CreditNote -> ShowS
GHC.Show.Show,
      CreditNote -> CreditNote -> Bool
(CreditNote -> CreditNote -> Bool)
-> (CreditNote -> CreditNote -> Bool) -> Eq CreditNote
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditNote -> CreditNote -> Bool
$c/= :: CreditNote -> CreditNote -> Bool
== :: CreditNote -> CreditNote -> Bool
$c== :: CreditNote -> CreditNote -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON CreditNote where
  toJSON :: CreditNote -> Value
toJSON CreditNote
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..= CreditNote -> Int
creditNoteAmount CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"created" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Int
creditNoteCreated CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"currency" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Text
creditNoteCurrency CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"customer" Text -> CreditNoteCustomer'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> CreditNoteCustomer'Variants
creditNoteCustomer CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"customer_balance_transaction" Text -> Maybe CreditNoteCustomerBalanceTransaction'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe CreditNoteCustomerBalanceTransaction'Variants
creditNoteCustomerBalanceTransaction CreditNote
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..= CreditNote -> Int
creditNoteDiscountAmount CreditNote
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..= CreditNote -> [DiscountsResourceDiscountAmount]
creditNoteDiscountAmounts CreditNote
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..= CreditNote -> Text
creditNoteId CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"invoice" Text -> CreditNoteInvoice'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> CreditNoteInvoice'Variants
creditNoteInvoice CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"lines" Text -> CreditNoteLines' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> CreditNoteLines'
creditNoteLines CreditNote
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..= CreditNote -> Bool
creditNoteLivemode CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"memo" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe Text
creditNoteMemo CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe Object
creditNoteMetadata CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"number" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Text
creditNoteNumber CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"out_of_band_amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe Int
creditNoteOutOfBandAmount CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"pdf" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Text
creditNotePdf CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"reason" Text -> Maybe CreditNoteReason' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe CreditNoteReason'
creditNoteReason CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"refund" Text -> Maybe CreditNoteRefund'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe CreditNoteRefund'Variants
creditNoteRefund CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"status" Text -> CreditNoteStatus' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> CreditNoteStatus'
creditNoteStatus CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"subtotal" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Int
creditNoteSubtotal CreditNote
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..= CreditNote -> [CreditNoteTaxAmount]
creditNoteTaxAmounts CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"total" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Int
creditNoteTotal CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> CreditNoteType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> CreditNoteType'
creditNoteType CreditNote
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"voided_at" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe Int
creditNoteVoidedAt CreditNote
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" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: CreditNote -> Encoding
toEncoding CreditNote
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..= CreditNote -> Int
creditNoteAmount CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"created" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Int
creditNoteCreated CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"currency" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Text
creditNoteCurrency CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"customer" Text -> CreditNoteCustomer'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> CreditNoteCustomer'Variants
creditNoteCustomer CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"customer_balance_transaction" Text
-> Maybe CreditNoteCustomerBalanceTransaction'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe CreditNoteCustomerBalanceTransaction'Variants
creditNoteCustomerBalanceTransaction CreditNote
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..= CreditNote -> Int
creditNoteDiscountAmount CreditNote
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..= CreditNote -> [DiscountsResourceDiscountAmount]
creditNoteDiscountAmounts CreditNote
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..= CreditNote -> Text
creditNoteId CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"invoice" Text -> CreditNoteInvoice'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> CreditNoteInvoice'Variants
creditNoteInvoice CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"lines" Text -> CreditNoteLines' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> CreditNoteLines'
creditNoteLines CreditNote
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..= CreditNote -> Bool
creditNoteLivemode CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"memo" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe Text
creditNoteMemo CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe Object
creditNoteMetadata CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"number" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Text
creditNoteNumber CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"out_of_band_amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe Int
creditNoteOutOfBandAmount CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"pdf" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Text
creditNotePdf CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"reason" Text -> Maybe CreditNoteReason' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe CreditNoteReason'
creditNoteReason CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"refund" Text -> Maybe CreditNoteRefund'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe CreditNoteRefund'Variants
creditNoteRefund CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"status" Text -> CreditNoteStatus' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> CreditNoteStatus'
creditNoteStatus CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"subtotal" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Int
creditNoteSubtotal CreditNote
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..= CreditNote -> [CreditNoteTaxAmount]
creditNoteTaxAmounts CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"total" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Int
creditNoteTotal CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"type" Text -> CreditNoteType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> CreditNoteType'
creditNoteType CreditNote
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"voided_at" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNote -> Maybe Int
creditNoteVoidedAt CreditNote
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")))))))))))))))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON CreditNote where
  parseJSON :: Value -> Parser CreditNote
parseJSON = String
-> (Object -> Parser CreditNote) -> Value -> Parser CreditNote
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"CreditNote" (\Object
obj -> ((((((((((((((((((((((((Int
 -> Int
 -> Text
 -> CreditNoteCustomer'Variants
 -> Maybe CreditNoteCustomerBalanceTransaction'Variants
 -> Int
 -> [DiscountsResourceDiscountAmount]
 -> Text
 -> CreditNoteInvoice'Variants
 -> CreditNoteLines'
 -> Bool
 -> Maybe Text
 -> Maybe Object
 -> Text
 -> Maybe Int
 -> Text
 -> Maybe CreditNoteReason'
 -> Maybe CreditNoteRefund'Variants
 -> CreditNoteStatus'
 -> Int
 -> [CreditNoteTaxAmount]
 -> Int
 -> CreditNoteType'
 -> Maybe Int
 -> CreditNote)
-> Parser
     (Int
      -> Int
      -> Text
      -> CreditNoteCustomer'Variants
      -> Maybe CreditNoteCustomerBalanceTransaction'Variants
      -> Int
      -> [DiscountsResourceDiscountAmount]
      -> Text
      -> CreditNoteInvoice'Variants
      -> CreditNoteLines'
      -> Bool
      -> Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Int
-> Int
-> Text
-> CreditNoteCustomer'Variants
-> Maybe CreditNoteCustomerBalanceTransaction'Variants
-> Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> CreditNoteInvoice'Variants
-> CreditNoteLines'
-> Bool
-> Maybe Text
-> Maybe Object
-> Text
-> Maybe Int
-> Text
-> Maybe CreditNoteReason'
-> Maybe CreditNoteRefund'Variants
-> CreditNoteStatus'
-> Int
-> [CreditNoteTaxAmount]
-> Int
-> CreditNoteType'
-> Maybe Int
-> CreditNote
CreditNote Parser
  (Int
   -> Int
   -> Text
   -> CreditNoteCustomer'Variants
   -> Maybe CreditNoteCustomerBalanceTransaction'Variants
   -> Int
   -> [DiscountsResourceDiscountAmount]
   -> Text
   -> CreditNoteInvoice'Variants
   -> CreditNoteLines'
   -> Bool
   -> Maybe Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser Int
-> Parser
     (Int
      -> Text
      -> CreditNoteCustomer'Variants
      -> Maybe CreditNoteCustomerBalanceTransaction'Variants
      -> Int
      -> [DiscountsResourceDiscountAmount]
      -> Text
      -> CreditNoteInvoice'Variants
      -> CreditNoteLines'
      -> Bool
      -> Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
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
  (Int
   -> Text
   -> CreditNoteCustomer'Variants
   -> Maybe CreditNoteCustomerBalanceTransaction'Variants
   -> Int
   -> [DiscountsResourceDiscountAmount]
   -> Text
   -> CreditNoteInvoice'Variants
   -> CreditNoteLines'
   -> Bool
   -> Maybe Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser Int
-> Parser
     (Text
      -> CreditNoteCustomer'Variants
      -> Maybe CreditNoteCustomerBalanceTransaction'Variants
      -> Int
      -> [DiscountsResourceDiscountAmount]
      -> Text
      -> CreditNoteInvoice'Variants
      -> CreditNoteLines'
      -> Bool
      -> Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
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
"created")) Parser
  (Text
   -> CreditNoteCustomer'Variants
   -> Maybe CreditNoteCustomerBalanceTransaction'Variants
   -> Int
   -> [DiscountsResourceDiscountAmount]
   -> Text
   -> CreditNoteInvoice'Variants
   -> CreditNoteLines'
   -> Bool
   -> Maybe Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser Text
-> Parser
     (CreditNoteCustomer'Variants
      -> Maybe CreditNoteCustomerBalanceTransaction'Variants
      -> Int
      -> [DiscountsResourceDiscountAmount]
      -> Text
      -> CreditNoteInvoice'Variants
      -> CreditNoteLines'
      -> Bool
      -> Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
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
"currency")) Parser
  (CreditNoteCustomer'Variants
   -> Maybe CreditNoteCustomerBalanceTransaction'Variants
   -> Int
   -> [DiscountsResourceDiscountAmount]
   -> Text
   -> CreditNoteInvoice'Variants
   -> CreditNoteLines'
   -> Bool
   -> Maybe Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser CreditNoteCustomer'Variants
-> Parser
     (Maybe CreditNoteCustomerBalanceTransaction'Variants
      -> Int
      -> [DiscountsResourceDiscountAmount]
      -> Text
      -> CreditNoteInvoice'Variants
      -> CreditNoteLines'
      -> Bool
      -> Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser CreditNoteCustomer'Variants
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"customer")) Parser
  (Maybe CreditNoteCustomerBalanceTransaction'Variants
   -> Int
   -> [DiscountsResourceDiscountAmount]
   -> Text
   -> CreditNoteInvoice'Variants
   -> CreditNoteLines'
   -> Bool
   -> Maybe Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser (Maybe CreditNoteCustomerBalanceTransaction'Variants)
-> Parser
     (Int
      -> [DiscountsResourceDiscountAmount]
      -> Text
      -> CreditNoteInvoice'Variants
      -> CreditNoteLines'
      -> Bool
      -> Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe CreditNoteCustomerBalanceTransaction'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"customer_balance_transaction")) Parser
  (Int
   -> [DiscountsResourceDiscountAmount]
   -> Text
   -> CreditNoteInvoice'Variants
   -> CreditNoteLines'
   -> Bool
   -> Maybe Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser Int
-> Parser
     ([DiscountsResourceDiscountAmount]
      -> Text
      -> CreditNoteInvoice'Variants
      -> CreditNoteLines'
      -> Bool
      -> Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
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
   -> CreditNoteInvoice'Variants
   -> CreditNoteLines'
   -> Bool
   -> Maybe Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser [DiscountsResourceDiscountAmount]
-> Parser
     (Text
      -> CreditNoteInvoice'Variants
      -> CreditNoteLines'
      -> Bool
      -> Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
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
   -> CreditNoteInvoice'Variants
   -> CreditNoteLines'
   -> Bool
   -> Maybe Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser Text
-> Parser
     (CreditNoteInvoice'Variants
      -> CreditNoteLines'
      -> Bool
      -> Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
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
  (CreditNoteInvoice'Variants
   -> CreditNoteLines'
   -> Bool
   -> Maybe Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser CreditNoteInvoice'Variants
-> Parser
     (CreditNoteLines'
      -> Bool
      -> Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser CreditNoteInvoice'Variants
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"invoice")) Parser
  (CreditNoteLines'
   -> Bool
   -> Maybe Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser CreditNoteLines'
-> Parser
     (Bool
      -> Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser CreditNoteLines'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"lines")) Parser
  (Bool
   -> Maybe Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser Bool
-> Parser
     (Maybe Text
      -> Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
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 Text
   -> Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser (Maybe Text)
-> Parser
     (Maybe Object
      -> Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
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
"memo")) Parser
  (Maybe Object
   -> Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser (Maybe Object)
-> Parser
     (Text
      -> Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Object)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"metadata")) Parser
  (Text
   -> Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser Text
-> Parser
     (Maybe Int
      -> Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
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
"number")) Parser
  (Maybe Int
   -> Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser (Maybe Int)
-> Parser
     (Text
      -> Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
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
"out_of_band_amount")) Parser
  (Text
   -> Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser Text
-> Parser
     (Maybe CreditNoteReason'
      -> Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
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
"pdf")) Parser
  (Maybe CreditNoteReason'
   -> Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser (Maybe CreditNoteReason')
-> Parser
     (Maybe CreditNoteRefund'Variants
      -> CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe CreditNoteReason')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"reason")) Parser
  (Maybe CreditNoteRefund'Variants
   -> CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser (Maybe CreditNoteRefund'Variants)
-> Parser
     (CreditNoteStatus'
      -> Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe CreditNoteRefund'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"refund")) Parser
  (CreditNoteStatus'
   -> Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser CreditNoteStatus'
-> Parser
     (Int
      -> [CreditNoteTaxAmount]
      -> Int
      -> CreditNoteType'
      -> Maybe Int
      -> CreditNote)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser CreditNoteStatus'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"status")) Parser
  (Int
   -> [CreditNoteTaxAmount]
   -> Int
   -> CreditNoteType'
   -> Maybe Int
   -> CreditNote)
-> Parser Int
-> Parser
     ([CreditNoteTaxAmount]
      -> Int -> CreditNoteType' -> Maybe Int -> CreditNote)
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
"subtotal")) Parser
  ([CreditNoteTaxAmount]
   -> Int -> CreditNoteType' -> Maybe Int -> CreditNote)
-> Parser [CreditNoteTaxAmount]
-> Parser (Int -> CreditNoteType' -> Maybe Int -> CreditNote)
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 (Int -> CreditNoteType' -> Maybe Int -> CreditNote)
-> Parser Int
-> Parser (CreditNoteType' -> Maybe Int -> CreditNote)
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
"total")) Parser (CreditNoteType' -> Maybe Int -> CreditNote)
-> Parser CreditNoteType' -> Parser (Maybe Int -> CreditNote)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser CreditNoteType'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"type")) Parser (Maybe Int -> CreditNote)
-> Parser (Maybe Int) -> Parser CreditNote
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
"voided_at"))

-- | Create a new 'CreditNote' with all required fields.
mkCreditNote ::
  -- | 'creditNoteAmount'
  GHC.Types.Int ->
  -- | 'creditNoteCreated'
  GHC.Types.Int ->
  -- | 'creditNoteCurrency'
  Data.Text.Internal.Text ->
  -- | 'creditNoteCustomer'
  CreditNoteCustomer'Variants ->
  -- | 'creditNoteDiscountAmount'
  GHC.Types.Int ->
  -- | 'creditNoteDiscountAmounts'
  [DiscountsResourceDiscountAmount] ->
  -- | 'creditNoteId'
  Data.Text.Internal.Text ->
  -- | 'creditNoteInvoice'
  CreditNoteInvoice'Variants ->
  -- | 'creditNoteLines'
  CreditNoteLines' ->
  -- | 'creditNoteLivemode'
  GHC.Types.Bool ->
  -- | 'creditNoteNumber'
  Data.Text.Internal.Text ->
  -- | 'creditNotePdf'
  Data.Text.Internal.Text ->
  -- | 'creditNoteStatus'
  CreditNoteStatus' ->
  -- | 'creditNoteSubtotal'
  GHC.Types.Int ->
  -- | 'creditNoteTaxAmounts'
  [CreditNoteTaxAmount] ->
  -- | 'creditNoteTotal'
  GHC.Types.Int ->
  -- | 'creditNoteType'
  CreditNoteType' ->
  CreditNote
mkCreditNote :: Int
-> Int
-> Text
-> CreditNoteCustomer'Variants
-> Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> CreditNoteInvoice'Variants
-> CreditNoteLines'
-> Bool
-> Text
-> Text
-> CreditNoteStatus'
-> Int
-> [CreditNoteTaxAmount]
-> Int
-> CreditNoteType'
-> CreditNote
mkCreditNote Int
creditNoteAmount Int
creditNoteCreated Text
creditNoteCurrency CreditNoteCustomer'Variants
creditNoteCustomer Int
creditNoteDiscountAmount [DiscountsResourceDiscountAmount]
creditNoteDiscountAmounts Text
creditNoteId CreditNoteInvoice'Variants
creditNoteInvoice CreditNoteLines'
creditNoteLines Bool
creditNoteLivemode Text
creditNoteNumber Text
creditNotePdf CreditNoteStatus'
creditNoteStatus Int
creditNoteSubtotal [CreditNoteTaxAmount]
creditNoteTaxAmounts Int
creditNoteTotal CreditNoteType'
creditNoteType =
  CreditNote :: Int
-> Int
-> Text
-> CreditNoteCustomer'Variants
-> Maybe CreditNoteCustomerBalanceTransaction'Variants
-> Int
-> [DiscountsResourceDiscountAmount]
-> Text
-> CreditNoteInvoice'Variants
-> CreditNoteLines'
-> Bool
-> Maybe Text
-> Maybe Object
-> Text
-> Maybe Int
-> Text
-> Maybe CreditNoteReason'
-> Maybe CreditNoteRefund'Variants
-> CreditNoteStatus'
-> Int
-> [CreditNoteTaxAmount]
-> Int
-> CreditNoteType'
-> Maybe Int
-> CreditNote
CreditNote
    { creditNoteAmount :: Int
creditNoteAmount = Int
creditNoteAmount,
      creditNoteCreated :: Int
creditNoteCreated = Int
creditNoteCreated,
      creditNoteCurrency :: Text
creditNoteCurrency = Text
creditNoteCurrency,
      creditNoteCustomer :: CreditNoteCustomer'Variants
creditNoteCustomer = CreditNoteCustomer'Variants
creditNoteCustomer,
      creditNoteCustomerBalanceTransaction :: Maybe CreditNoteCustomerBalanceTransaction'Variants
creditNoteCustomerBalanceTransaction = Maybe CreditNoteCustomerBalanceTransaction'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      creditNoteDiscountAmount :: Int
creditNoteDiscountAmount = Int
creditNoteDiscountAmount,
      creditNoteDiscountAmounts :: [DiscountsResourceDiscountAmount]
creditNoteDiscountAmounts = [DiscountsResourceDiscountAmount]
creditNoteDiscountAmounts,
      creditNoteId :: Text
creditNoteId = Text
creditNoteId,
      creditNoteInvoice :: CreditNoteInvoice'Variants
creditNoteInvoice = CreditNoteInvoice'Variants
creditNoteInvoice,
      creditNoteLines :: CreditNoteLines'
creditNoteLines = CreditNoteLines'
creditNoteLines,
      creditNoteLivemode :: Bool
creditNoteLivemode = Bool
creditNoteLivemode,
      creditNoteMemo :: Maybe Text
creditNoteMemo = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      creditNoteMetadata :: Maybe Object
creditNoteMetadata = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      creditNoteNumber :: Text
creditNoteNumber = Text
creditNoteNumber,
      creditNoteOutOfBandAmount :: Maybe Int
creditNoteOutOfBandAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      creditNotePdf :: Text
creditNotePdf = Text
creditNotePdf,
      creditNoteReason :: Maybe CreditNoteReason'
creditNoteReason = Maybe CreditNoteReason'
forall a. Maybe a
GHC.Maybe.Nothing,
      creditNoteRefund :: Maybe CreditNoteRefund'Variants
creditNoteRefund = Maybe CreditNoteRefund'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      creditNoteStatus :: CreditNoteStatus'
creditNoteStatus = CreditNoteStatus'
creditNoteStatus,
      creditNoteSubtotal :: Int
creditNoteSubtotal = Int
creditNoteSubtotal,
      creditNoteTaxAmounts :: [CreditNoteTaxAmount]
creditNoteTaxAmounts = [CreditNoteTaxAmount]
creditNoteTaxAmounts,
      creditNoteTotal :: Int
creditNoteTotal = Int
creditNoteTotal,
      creditNoteType :: CreditNoteType'
creditNoteType = CreditNoteType'
creditNoteType,
      creditNoteVoidedAt :: Maybe Int
creditNoteVoidedAt = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the oneOf schema located at @components.schemas.credit_note.properties.customer.anyOf@ in the specification.
--
-- ID of the customer.
data CreditNoteCustomer'Variants
  = CreditNoteCustomer'Text Data.Text.Internal.Text
  | CreditNoteCustomer'Customer Customer
  | CreditNoteCustomer'DeletedCustomer DeletedCustomer
  deriving (Int -> CreditNoteCustomer'Variants -> ShowS
[CreditNoteCustomer'Variants] -> ShowS
CreditNoteCustomer'Variants -> String
(Int -> CreditNoteCustomer'Variants -> ShowS)
-> (CreditNoteCustomer'Variants -> String)
-> ([CreditNoteCustomer'Variants] -> ShowS)
-> Show CreditNoteCustomer'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditNoteCustomer'Variants] -> ShowS
$cshowList :: [CreditNoteCustomer'Variants] -> ShowS
show :: CreditNoteCustomer'Variants -> String
$cshow :: CreditNoteCustomer'Variants -> String
showsPrec :: Int -> CreditNoteCustomer'Variants -> ShowS
$cshowsPrec :: Int -> CreditNoteCustomer'Variants -> ShowS
GHC.Show.Show, CreditNoteCustomer'Variants -> CreditNoteCustomer'Variants -> Bool
(CreditNoteCustomer'Variants
 -> CreditNoteCustomer'Variants -> Bool)
-> (CreditNoteCustomer'Variants
    -> CreditNoteCustomer'Variants -> Bool)
-> Eq CreditNoteCustomer'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditNoteCustomer'Variants -> CreditNoteCustomer'Variants -> Bool
$c/= :: CreditNoteCustomer'Variants -> CreditNoteCustomer'Variants -> Bool
== :: CreditNoteCustomer'Variants -> CreditNoteCustomer'Variants -> Bool
$c== :: CreditNoteCustomer'Variants -> CreditNoteCustomer'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteCustomer'Variants where
  toJSON :: CreditNoteCustomer'Variants -> Value
toJSON (CreditNoteCustomer'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (CreditNoteCustomer'Customer Customer
a) = Customer -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Customer
a
  toJSON (CreditNoteCustomer'DeletedCustomer DeletedCustomer
a) = DeletedCustomer -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON DeletedCustomer
a

instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteCustomer'Variants where
  parseJSON :: Value -> Parser CreditNoteCustomer'Variants
parseJSON Value
val = case (Text -> CreditNoteCustomer'Variants
CreditNoteCustomer'Text (Text -> CreditNoteCustomer'Variants)
-> Result Text -> Result CreditNoteCustomer'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result CreditNoteCustomer'Variants
-> Result CreditNoteCustomer'Variants
-> Result CreditNoteCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Customer -> CreditNoteCustomer'Variants
CreditNoteCustomer'Customer (Customer -> CreditNoteCustomer'Variants)
-> Result Customer -> Result CreditNoteCustomer'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Customer
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result CreditNoteCustomer'Variants
-> Result CreditNoteCustomer'Variants
-> Result CreditNoteCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((DeletedCustomer -> CreditNoteCustomer'Variants
CreditNoteCustomer'DeletedCustomer (DeletedCustomer -> CreditNoteCustomer'Variants)
-> Result DeletedCustomer -> Result CreditNoteCustomer'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result DeletedCustomer
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result CreditNoteCustomer'Variants
-> Result CreditNoteCustomer'Variants
-> Result CreditNoteCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result CreditNoteCustomer'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched")) of
    Data.Aeson.Types.Internal.Success CreditNoteCustomer'Variants
a -> CreditNoteCustomer'Variants -> Parser CreditNoteCustomer'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure CreditNoteCustomer'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser CreditNoteCustomer'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the oneOf schema located at @components.schemas.credit_note.properties.customer_balance_transaction.anyOf@ in the specification.
--
-- Customer balance transaction related to this credit note.
data CreditNoteCustomerBalanceTransaction'Variants
  = CreditNoteCustomerBalanceTransaction'Text Data.Text.Internal.Text
  | CreditNoteCustomerBalanceTransaction'CustomerBalanceTransaction CustomerBalanceTransaction
  deriving (Int -> CreditNoteCustomerBalanceTransaction'Variants -> ShowS
[CreditNoteCustomerBalanceTransaction'Variants] -> ShowS
CreditNoteCustomerBalanceTransaction'Variants -> String
(Int -> CreditNoteCustomerBalanceTransaction'Variants -> ShowS)
-> (CreditNoteCustomerBalanceTransaction'Variants -> String)
-> ([CreditNoteCustomerBalanceTransaction'Variants] -> ShowS)
-> Show CreditNoteCustomerBalanceTransaction'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditNoteCustomerBalanceTransaction'Variants] -> ShowS
$cshowList :: [CreditNoteCustomerBalanceTransaction'Variants] -> ShowS
show :: CreditNoteCustomerBalanceTransaction'Variants -> String
$cshow :: CreditNoteCustomerBalanceTransaction'Variants -> String
showsPrec :: Int -> CreditNoteCustomerBalanceTransaction'Variants -> ShowS
$cshowsPrec :: Int -> CreditNoteCustomerBalanceTransaction'Variants -> ShowS
GHC.Show.Show, CreditNoteCustomerBalanceTransaction'Variants
-> CreditNoteCustomerBalanceTransaction'Variants -> Bool
(CreditNoteCustomerBalanceTransaction'Variants
 -> CreditNoteCustomerBalanceTransaction'Variants -> Bool)
-> (CreditNoteCustomerBalanceTransaction'Variants
    -> CreditNoteCustomerBalanceTransaction'Variants -> Bool)
-> Eq CreditNoteCustomerBalanceTransaction'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditNoteCustomerBalanceTransaction'Variants
-> CreditNoteCustomerBalanceTransaction'Variants -> Bool
$c/= :: CreditNoteCustomerBalanceTransaction'Variants
-> CreditNoteCustomerBalanceTransaction'Variants -> Bool
== :: CreditNoteCustomerBalanceTransaction'Variants
-> CreditNoteCustomerBalanceTransaction'Variants -> Bool
$c== :: CreditNoteCustomerBalanceTransaction'Variants
-> CreditNoteCustomerBalanceTransaction'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteCustomerBalanceTransaction'Variants where
  toJSON :: CreditNoteCustomerBalanceTransaction'Variants -> Value
toJSON (CreditNoteCustomerBalanceTransaction'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (CreditNoteCustomerBalanceTransaction'CustomerBalanceTransaction CustomerBalanceTransaction
a) = CustomerBalanceTransaction -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON CustomerBalanceTransaction
a

instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteCustomerBalanceTransaction'Variants where
  parseJSON :: Value -> Parser CreditNoteCustomerBalanceTransaction'Variants
parseJSON Value
val = case (Text -> CreditNoteCustomerBalanceTransaction'Variants
CreditNoteCustomerBalanceTransaction'Text (Text -> CreditNoteCustomerBalanceTransaction'Variants)
-> Result Text
-> Result CreditNoteCustomerBalanceTransaction'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result CreditNoteCustomerBalanceTransaction'Variants
-> Result CreditNoteCustomerBalanceTransaction'Variants
-> Result CreditNoteCustomerBalanceTransaction'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((CustomerBalanceTransaction
-> CreditNoteCustomerBalanceTransaction'Variants
CreditNoteCustomerBalanceTransaction'CustomerBalanceTransaction (CustomerBalanceTransaction
 -> CreditNoteCustomerBalanceTransaction'Variants)
-> Result CustomerBalanceTransaction
-> Result CreditNoteCustomerBalanceTransaction'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result CustomerBalanceTransaction
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result CreditNoteCustomerBalanceTransaction'Variants
-> Result CreditNoteCustomerBalanceTransaction'Variants
-> Result CreditNoteCustomerBalanceTransaction'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result CreditNoteCustomerBalanceTransaction'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
    Data.Aeson.Types.Internal.Success CreditNoteCustomerBalanceTransaction'Variants
a -> CreditNoteCustomerBalanceTransaction'Variants
-> Parser CreditNoteCustomerBalanceTransaction'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure CreditNoteCustomerBalanceTransaction'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser CreditNoteCustomerBalanceTransaction'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the oneOf schema located at @components.schemas.credit_note.properties.invoice.anyOf@ in the specification.
--
-- ID of the invoice.
data CreditNoteInvoice'Variants
  = CreditNoteInvoice'Text Data.Text.Internal.Text
  | CreditNoteInvoice'Invoice Invoice
  deriving (Int -> CreditNoteInvoice'Variants -> ShowS
[CreditNoteInvoice'Variants] -> ShowS
CreditNoteInvoice'Variants -> String
(Int -> CreditNoteInvoice'Variants -> ShowS)
-> (CreditNoteInvoice'Variants -> String)
-> ([CreditNoteInvoice'Variants] -> ShowS)
-> Show CreditNoteInvoice'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditNoteInvoice'Variants] -> ShowS
$cshowList :: [CreditNoteInvoice'Variants] -> ShowS
show :: CreditNoteInvoice'Variants -> String
$cshow :: CreditNoteInvoice'Variants -> String
showsPrec :: Int -> CreditNoteInvoice'Variants -> ShowS
$cshowsPrec :: Int -> CreditNoteInvoice'Variants -> ShowS
GHC.Show.Show, CreditNoteInvoice'Variants -> CreditNoteInvoice'Variants -> Bool
(CreditNoteInvoice'Variants -> CreditNoteInvoice'Variants -> Bool)
-> (CreditNoteInvoice'Variants
    -> CreditNoteInvoice'Variants -> Bool)
-> Eq CreditNoteInvoice'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditNoteInvoice'Variants -> CreditNoteInvoice'Variants -> Bool
$c/= :: CreditNoteInvoice'Variants -> CreditNoteInvoice'Variants -> Bool
== :: CreditNoteInvoice'Variants -> CreditNoteInvoice'Variants -> Bool
$c== :: CreditNoteInvoice'Variants -> CreditNoteInvoice'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteInvoice'Variants where
  toJSON :: CreditNoteInvoice'Variants -> Value
toJSON (CreditNoteInvoice'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (CreditNoteInvoice'Invoice Invoice
a) = Invoice -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Invoice
a

instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteInvoice'Variants where
  parseJSON :: Value -> Parser CreditNoteInvoice'Variants
parseJSON Value
val = case (Text -> CreditNoteInvoice'Variants
CreditNoteInvoice'Text (Text -> CreditNoteInvoice'Variants)
-> Result Text -> Result CreditNoteInvoice'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result CreditNoteInvoice'Variants
-> Result CreditNoteInvoice'Variants
-> Result CreditNoteInvoice'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Invoice -> CreditNoteInvoice'Variants
CreditNoteInvoice'Invoice (Invoice -> CreditNoteInvoice'Variants)
-> Result Invoice -> Result CreditNoteInvoice'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Invoice
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result CreditNoteInvoice'Variants
-> Result CreditNoteInvoice'Variants
-> Result CreditNoteInvoice'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result CreditNoteInvoice'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
    Data.Aeson.Types.Internal.Success CreditNoteInvoice'Variants
a -> CreditNoteInvoice'Variants -> Parser CreditNoteInvoice'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure CreditNoteInvoice'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser CreditNoteInvoice'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the object schema located at @components.schemas.credit_note.properties.lines@ in the specification.
--
-- Line items that make up the credit note
data CreditNoteLines' = CreditNoteLines'
  { -- | data: Details about each object.
    CreditNoteLines' -> [CreditNoteLineItem]
creditNoteLines'Data :: ([CreditNoteLineItem]),
    -- | has_more: True if this list has another page of items after this one that can be fetched.
    CreditNoteLines' -> Bool
creditNoteLines'HasMore :: GHC.Types.Bool,
    -- | url: The URL where this list can be accessed.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    CreditNoteLines' -> Text
creditNoteLines'Url :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> CreditNoteLines' -> ShowS
[CreditNoteLines'] -> ShowS
CreditNoteLines' -> String
(Int -> CreditNoteLines' -> ShowS)
-> (CreditNoteLines' -> String)
-> ([CreditNoteLines'] -> ShowS)
-> Show CreditNoteLines'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditNoteLines'] -> ShowS
$cshowList :: [CreditNoteLines'] -> ShowS
show :: CreditNoteLines' -> String
$cshow :: CreditNoteLines' -> String
showsPrec :: Int -> CreditNoteLines' -> ShowS
$cshowsPrec :: Int -> CreditNoteLines' -> ShowS
GHC.Show.Show,
      CreditNoteLines' -> CreditNoteLines' -> Bool
(CreditNoteLines' -> CreditNoteLines' -> Bool)
-> (CreditNoteLines' -> CreditNoteLines' -> Bool)
-> Eq CreditNoteLines'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditNoteLines' -> CreditNoteLines' -> Bool
$c/= :: CreditNoteLines' -> CreditNoteLines' -> Bool
== :: CreditNoteLines' -> CreditNoteLines' -> Bool
$c== :: CreditNoteLines' -> CreditNoteLines' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteLines' where
  toJSON :: CreditNoteLines' -> Value
toJSON CreditNoteLines'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"data" Text -> [CreditNoteLineItem] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLines' -> [CreditNoteLineItem]
creditNoteLines'Data CreditNoteLines'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"has_more" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLines' -> Bool
creditNoteLines'HasMore CreditNoteLines'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLines' -> Text
creditNoteLines'Url CreditNoteLines'
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
"list" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: CreditNoteLines' -> Encoding
toEncoding CreditNoteLines'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"data" Text -> [CreditNoteLineItem] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLines' -> [CreditNoteLineItem]
creditNoteLines'Data CreditNoteLines'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"has_more" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLines' -> Bool
creditNoteLines'HasMore CreditNoteLines'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"url" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CreditNoteLines' -> Text
creditNoteLines'Url CreditNoteLines'
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
"list"))))

instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteLines' where
  parseJSON :: Value -> Parser CreditNoteLines'
parseJSON = String
-> (Object -> Parser CreditNoteLines')
-> Value
-> Parser CreditNoteLines'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"CreditNoteLines'" (\Object
obj -> ((([CreditNoteLineItem] -> Bool -> Text -> CreditNoteLines')
-> Parser
     ([CreditNoteLineItem] -> Bool -> Text -> CreditNoteLines')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure [CreditNoteLineItem] -> Bool -> Text -> CreditNoteLines'
CreditNoteLines' Parser ([CreditNoteLineItem] -> Bool -> Text -> CreditNoteLines')
-> Parser [CreditNoteLineItem]
-> Parser (Bool -> Text -> CreditNoteLines')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser [CreditNoteLineItem]
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"data")) Parser (Bool -> Text -> CreditNoteLines')
-> Parser Bool -> Parser (Text -> CreditNoteLines')
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
"has_more")) Parser (Text -> CreditNoteLines')
-> Parser Text -> Parser CreditNoteLines'
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
"url"))

-- | Create a new 'CreditNoteLines'' with all required fields.
mkCreditNoteLines' ::
  -- | 'creditNoteLines'Data'
  [CreditNoteLineItem] ->
  -- | 'creditNoteLines'HasMore'
  GHC.Types.Bool ->
  -- | 'creditNoteLines'Url'
  Data.Text.Internal.Text ->
  CreditNoteLines'
mkCreditNoteLines' :: [CreditNoteLineItem] -> Bool -> Text -> CreditNoteLines'
mkCreditNoteLines' [CreditNoteLineItem]
creditNoteLines'Data Bool
creditNoteLines'HasMore Text
creditNoteLines'Url =
  CreditNoteLines' :: [CreditNoteLineItem] -> Bool -> Text -> CreditNoteLines'
CreditNoteLines'
    { creditNoteLines'Data :: [CreditNoteLineItem]
creditNoteLines'Data = [CreditNoteLineItem]
creditNoteLines'Data,
      creditNoteLines'HasMore :: Bool
creditNoteLines'HasMore = Bool
creditNoteLines'HasMore,
      creditNoteLines'Url :: Text
creditNoteLines'Url = Text
creditNoteLines'Url
    }

-- | Defines the enum schema located at @components.schemas.credit_note.properties.reason@ in the specification.
--
-- Reason for issuing this credit note, one of \`duplicate\`, \`fraudulent\`, \`order_change\`, or \`product_unsatisfactory\`
data CreditNoteReason'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    CreditNoteReason'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.
    CreditNoteReason'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"duplicate"@
    CreditNoteReason'EnumDuplicate
  | -- | Represents the JSON value @"fraudulent"@
    CreditNoteReason'EnumFraudulent
  | -- | Represents the JSON value @"order_change"@
    CreditNoteReason'EnumOrderChange
  | -- | Represents the JSON value @"product_unsatisfactory"@
    CreditNoteReason'EnumProductUnsatisfactory
  deriving (Int -> CreditNoteReason' -> ShowS
[CreditNoteReason'] -> ShowS
CreditNoteReason' -> String
(Int -> CreditNoteReason' -> ShowS)
-> (CreditNoteReason' -> String)
-> ([CreditNoteReason'] -> ShowS)
-> Show CreditNoteReason'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditNoteReason'] -> ShowS
$cshowList :: [CreditNoteReason'] -> ShowS
show :: CreditNoteReason' -> String
$cshow :: CreditNoteReason' -> String
showsPrec :: Int -> CreditNoteReason' -> ShowS
$cshowsPrec :: Int -> CreditNoteReason' -> ShowS
GHC.Show.Show, CreditNoteReason' -> CreditNoteReason' -> Bool
(CreditNoteReason' -> CreditNoteReason' -> Bool)
-> (CreditNoteReason' -> CreditNoteReason' -> Bool)
-> Eq CreditNoteReason'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditNoteReason' -> CreditNoteReason' -> Bool
$c/= :: CreditNoteReason' -> CreditNoteReason' -> Bool
== :: CreditNoteReason' -> CreditNoteReason' -> Bool
$c== :: CreditNoteReason' -> CreditNoteReason' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteReason' where
  toJSON :: CreditNoteReason' -> Value
toJSON (CreditNoteReason'Other Value
val) = Value
val
  toJSON (CreditNoteReason'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (CreditNoteReason'
CreditNoteReason'EnumDuplicate) = Value
"duplicate"
  toJSON (CreditNoteReason'
CreditNoteReason'EnumFraudulent) = Value
"fraudulent"
  toJSON (CreditNoteReason'
CreditNoteReason'EnumOrderChange) = Value
"order_change"
  toJSON (CreditNoteReason'
CreditNoteReason'EnumProductUnsatisfactory) = Value
"product_unsatisfactory"

instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteReason' where
  parseJSON :: Value -> Parser CreditNoteReason'
parseJSON Value
val =
    CreditNoteReason' -> Parser CreditNoteReason'
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
"duplicate" -> CreditNoteReason'
CreditNoteReason'EnumDuplicate
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"fraudulent" -> CreditNoteReason'
CreditNoteReason'EnumFraudulent
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"order_change" -> CreditNoteReason'
CreditNoteReason'EnumOrderChange
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"product_unsatisfactory" -> CreditNoteReason'
CreditNoteReason'EnumProductUnsatisfactory
            | Bool
GHC.Base.otherwise -> Value -> CreditNoteReason'
CreditNoteReason'Other Value
val
      )

-- | Defines the oneOf schema located at @components.schemas.credit_note.properties.refund.anyOf@ in the specification.
--
-- Refund related to this credit note.
data CreditNoteRefund'Variants
  = CreditNoteRefund'Text Data.Text.Internal.Text
  | CreditNoteRefund'Refund Refund
  deriving (Int -> CreditNoteRefund'Variants -> ShowS
[CreditNoteRefund'Variants] -> ShowS
CreditNoteRefund'Variants -> String
(Int -> CreditNoteRefund'Variants -> ShowS)
-> (CreditNoteRefund'Variants -> String)
-> ([CreditNoteRefund'Variants] -> ShowS)
-> Show CreditNoteRefund'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditNoteRefund'Variants] -> ShowS
$cshowList :: [CreditNoteRefund'Variants] -> ShowS
show :: CreditNoteRefund'Variants -> String
$cshow :: CreditNoteRefund'Variants -> String
showsPrec :: Int -> CreditNoteRefund'Variants -> ShowS
$cshowsPrec :: Int -> CreditNoteRefund'Variants -> ShowS
GHC.Show.Show, CreditNoteRefund'Variants -> CreditNoteRefund'Variants -> Bool
(CreditNoteRefund'Variants -> CreditNoteRefund'Variants -> Bool)
-> (CreditNoteRefund'Variants -> CreditNoteRefund'Variants -> Bool)
-> Eq CreditNoteRefund'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditNoteRefund'Variants -> CreditNoteRefund'Variants -> Bool
$c/= :: CreditNoteRefund'Variants -> CreditNoteRefund'Variants -> Bool
== :: CreditNoteRefund'Variants -> CreditNoteRefund'Variants -> Bool
$c== :: CreditNoteRefund'Variants -> CreditNoteRefund'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteRefund'Variants where
  toJSON :: CreditNoteRefund'Variants -> Value
toJSON (CreditNoteRefund'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (CreditNoteRefund'Refund Refund
a) = Refund -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Refund
a

instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteRefund'Variants where
  parseJSON :: Value -> Parser CreditNoteRefund'Variants
parseJSON Value
val = case (Text -> CreditNoteRefund'Variants
CreditNoteRefund'Text (Text -> CreditNoteRefund'Variants)
-> Result Text -> Result CreditNoteRefund'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result CreditNoteRefund'Variants
-> Result CreditNoteRefund'Variants
-> Result CreditNoteRefund'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Refund -> CreditNoteRefund'Variants
CreditNoteRefund'Refund (Refund -> CreditNoteRefund'Variants)
-> Result Refund -> Result CreditNoteRefund'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Refund
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result CreditNoteRefund'Variants
-> Result CreditNoteRefund'Variants
-> Result CreditNoteRefund'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result CreditNoteRefund'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
    Data.Aeson.Types.Internal.Success CreditNoteRefund'Variants
a -> CreditNoteRefund'Variants -> Parser CreditNoteRefund'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure CreditNoteRefund'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser CreditNoteRefund'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the enum schema located at @components.schemas.credit_note.properties.status@ in the specification.
--
-- Status of this credit note, one of \`issued\` or \`void\`. Learn more about [voiding credit notes](https:\/\/stripe.com\/docs\/billing\/invoices\/credit-notes\#voiding).
data CreditNoteStatus'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    CreditNoteStatus'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.
    CreditNoteStatus'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"issued"@
    CreditNoteStatus'EnumIssued
  | -- | Represents the JSON value @"void"@
    CreditNoteStatus'EnumVoid
  deriving (Int -> CreditNoteStatus' -> ShowS
[CreditNoteStatus'] -> ShowS
CreditNoteStatus' -> String
(Int -> CreditNoteStatus' -> ShowS)
-> (CreditNoteStatus' -> String)
-> ([CreditNoteStatus'] -> ShowS)
-> Show CreditNoteStatus'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditNoteStatus'] -> ShowS
$cshowList :: [CreditNoteStatus'] -> ShowS
show :: CreditNoteStatus' -> String
$cshow :: CreditNoteStatus' -> String
showsPrec :: Int -> CreditNoteStatus' -> ShowS
$cshowsPrec :: Int -> CreditNoteStatus' -> ShowS
GHC.Show.Show, CreditNoteStatus' -> CreditNoteStatus' -> Bool
(CreditNoteStatus' -> CreditNoteStatus' -> Bool)
-> (CreditNoteStatus' -> CreditNoteStatus' -> Bool)
-> Eq CreditNoteStatus'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditNoteStatus' -> CreditNoteStatus' -> Bool
$c/= :: CreditNoteStatus' -> CreditNoteStatus' -> Bool
== :: CreditNoteStatus' -> CreditNoteStatus' -> Bool
$c== :: CreditNoteStatus' -> CreditNoteStatus' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteStatus' where
  toJSON :: CreditNoteStatus' -> Value
toJSON (CreditNoteStatus'Other Value
val) = Value
val
  toJSON (CreditNoteStatus'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (CreditNoteStatus'
CreditNoteStatus'EnumIssued) = Value
"issued"
  toJSON (CreditNoteStatus'
CreditNoteStatus'EnumVoid) = Value
"void"

instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteStatus' where
  parseJSON :: Value -> Parser CreditNoteStatus'
parseJSON Value
val =
    CreditNoteStatus' -> Parser CreditNoteStatus'
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
"issued" -> CreditNoteStatus'
CreditNoteStatus'EnumIssued
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"void" -> CreditNoteStatus'
CreditNoteStatus'EnumVoid
            | Bool
GHC.Base.otherwise -> Value -> CreditNoteStatus'
CreditNoteStatus'Other Value
val
      )

-- | Defines the enum schema located at @components.schemas.credit_note.properties.type@ in the specification.
--
-- Type of this credit note, one of \`pre_payment\` or \`post_payment\`. A \`pre_payment\` credit note means it was issued when the invoice was open. A \`post_payment\` credit note means it was issued when the invoice was paid.
data CreditNoteType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    CreditNoteType'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.
    CreditNoteType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"post_payment"@
    CreditNoteType'EnumPostPayment
  | -- | Represents the JSON value @"pre_payment"@
    CreditNoteType'EnumPrePayment
  deriving (Int -> CreditNoteType' -> ShowS
[CreditNoteType'] -> ShowS
CreditNoteType' -> String
(Int -> CreditNoteType' -> ShowS)
-> (CreditNoteType' -> String)
-> ([CreditNoteType'] -> ShowS)
-> Show CreditNoteType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditNoteType'] -> ShowS
$cshowList :: [CreditNoteType'] -> ShowS
show :: CreditNoteType' -> String
$cshow :: CreditNoteType' -> String
showsPrec :: Int -> CreditNoteType' -> ShowS
$cshowsPrec :: Int -> CreditNoteType' -> ShowS
GHC.Show.Show, CreditNoteType' -> CreditNoteType' -> Bool
(CreditNoteType' -> CreditNoteType' -> Bool)
-> (CreditNoteType' -> CreditNoteType' -> Bool)
-> Eq CreditNoteType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditNoteType' -> CreditNoteType' -> Bool
$c/= :: CreditNoteType' -> CreditNoteType' -> Bool
== :: CreditNoteType' -> CreditNoteType' -> Bool
$c== :: CreditNoteType' -> CreditNoteType' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteType' where
  toJSON :: CreditNoteType' -> Value
toJSON (CreditNoteType'Other Value
val) = Value
val
  toJSON (CreditNoteType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (CreditNoteType'
CreditNoteType'EnumPostPayment) = Value
"post_payment"
  toJSON (CreditNoteType'
CreditNoteType'EnumPrePayment) = Value
"pre_payment"

instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteType' where
  parseJSON :: Value -> Parser CreditNoteType'
parseJSON Value
val =
    CreditNoteType' -> Parser CreditNoteType'
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
"post_payment" -> CreditNoteType'
CreditNoteType'EnumPostPayment
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"pre_payment" -> CreditNoteType'
CreditNoteType'EnumPrePayment
            | Bool
GHC.Base.otherwise -> Value -> CreditNoteType'
CreditNoteType'Other Value
val
      )