{-# 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.Foldable import qualified Data.Functor import qualified Data.Maybe 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. creditNoteAmount :: GHC.Types.Int, -- | created: Time at which the object was created. Measured in seconds since the Unix epoch. 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). creditNoteCurrency :: Data.Text.Internal.Text, -- | customer: ID of the customer. creditNoteCustomer :: CreditNoteCustomer'Variants, -- | customer_balance_transaction: Customer balance transaction related to this credit note. creditNoteCustomerBalanceTransaction :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable CreditNoteCustomerBalanceTransaction'NonNullableVariants)), -- | discount_amount: The integer amount in %s representing the total amount of discount that was credited. creditNoteDiscountAmount :: GHC.Types.Int, -- | discount_amounts: The aggregate amounts calculated per discount for all line items. creditNoteDiscountAmounts :: ([DiscountsResourceDiscountAmount]), -- | id: Unique identifier for the object. -- -- Constraints: -- -- * Maximum length of 5000 creditNoteId :: Data.Text.Internal.Text, -- | invoice: ID of the invoice. creditNoteInvoice :: CreditNoteInvoice'Variants, -- | lines: Line items that make up the credit note 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. creditNoteLivemode :: GHC.Types.Bool, -- | memo: Customer-facing text that appears on the credit note PDF. -- -- Constraints: -- -- * Maximum length of 5000 creditNoteMemo :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable 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. creditNoteMetadata :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable 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 creditNoteNumber :: Data.Text.Internal.Text, -- | out_of_band_amount: Amount that was credited outside of Stripe. creditNoteOutOfBandAmount :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable GHC.Types.Int)), -- | pdf: The link to download the PDF of the credit note. -- -- Constraints: -- -- * Maximum length of 5000 creditNotePdf :: Data.Text.Internal.Text, -- | reason: Reason for issuing this credit note, one of \`duplicate\`, \`fraudulent\`, \`order_change\`, or \`product_unsatisfactory\` creditNoteReason :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable CreditNoteReason'NonNullable)), -- | refund: Refund related to this credit note. creditNoteRefund :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable CreditNoteRefund'NonNullableVariants)), -- | 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). creditNoteStatus :: CreditNoteStatus', -- | subtotal: The integer amount in %s representing the amount of the credit note, excluding exclusive tax and invoice level discounts. creditNoteSubtotal :: GHC.Types.Int, -- | subtotal_excluding_tax: The integer amount in %s representing the amount of the credit note, excluding all tax and invoice level discounts. creditNoteSubtotalExcludingTax :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable GHC.Types.Int)), -- | tax_amounts: The aggregate amounts calculated per tax rate for all line items. creditNoteTaxAmounts :: ([CreditNoteTaxAmount]), -- | total: The integer amount in %s representing the total amount of the credit note, including tax and all discount. creditNoteTotal :: GHC.Types.Int, -- | total_excluding_tax: The integer amount in %s representing the total amount of the credit note, excluding tax, but including discounts. creditNoteTotalExcludingTax :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable 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. creditNoteType :: CreditNoteType', -- | voided_at: The time that the credit note was voided. creditNoteVoidedAt :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable GHC.Types.Int)) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON CreditNote where toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (["amount" Data.Aeson.Types.ToJSON..= creditNoteAmount obj] : ["created" Data.Aeson.Types.ToJSON..= creditNoteCreated obj] : ["currency" Data.Aeson.Types.ToJSON..= creditNoteCurrency obj] : ["customer" Data.Aeson.Types.ToJSON..= creditNoteCustomer obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("customer_balance_transaction" Data.Aeson.Types.ToJSON..=)) (creditNoteCustomerBalanceTransaction obj) : ["discount_amount" Data.Aeson.Types.ToJSON..= creditNoteDiscountAmount obj] : ["discount_amounts" Data.Aeson.Types.ToJSON..= creditNoteDiscountAmounts obj] : ["id" Data.Aeson.Types.ToJSON..= creditNoteId obj] : ["invoice" Data.Aeson.Types.ToJSON..= creditNoteInvoice obj] : ["lines" Data.Aeson.Types.ToJSON..= creditNoteLines obj] : ["livemode" Data.Aeson.Types.ToJSON..= creditNoteLivemode obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("memo" Data.Aeson.Types.ToJSON..=)) (creditNoteMemo obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("metadata" Data.Aeson.Types.ToJSON..=)) (creditNoteMetadata obj) : ["number" Data.Aeson.Types.ToJSON..= creditNoteNumber obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("out_of_band_amount" Data.Aeson.Types.ToJSON..=)) (creditNoteOutOfBandAmount obj) : ["pdf" Data.Aeson.Types.ToJSON..= creditNotePdf obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("reason" Data.Aeson.Types.ToJSON..=)) (creditNoteReason obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("refund" Data.Aeson.Types.ToJSON..=)) (creditNoteRefund obj) : ["status" Data.Aeson.Types.ToJSON..= creditNoteStatus obj] : ["subtotal" Data.Aeson.Types.ToJSON..= creditNoteSubtotal obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("subtotal_excluding_tax" Data.Aeson.Types.ToJSON..=)) (creditNoteSubtotalExcludingTax obj) : ["tax_amounts" Data.Aeson.Types.ToJSON..= creditNoteTaxAmounts obj] : ["total" Data.Aeson.Types.ToJSON..= creditNoteTotal obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("total_excluding_tax" Data.Aeson.Types.ToJSON..=)) (creditNoteTotalExcludingTax obj) : ["type" Data.Aeson.Types.ToJSON..= creditNoteType obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("voided_at" Data.Aeson.Types.ToJSON..=)) (creditNoteVoidedAt obj) : ["object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "credit_note"] : GHC.Base.mempty)) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (["amount" Data.Aeson.Types.ToJSON..= creditNoteAmount obj] : ["created" Data.Aeson.Types.ToJSON..= creditNoteCreated obj] : ["currency" Data.Aeson.Types.ToJSON..= creditNoteCurrency obj] : ["customer" Data.Aeson.Types.ToJSON..= creditNoteCustomer obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("customer_balance_transaction" Data.Aeson.Types.ToJSON..=)) (creditNoteCustomerBalanceTransaction obj) : ["discount_amount" Data.Aeson.Types.ToJSON..= creditNoteDiscountAmount obj] : ["discount_amounts" Data.Aeson.Types.ToJSON..= creditNoteDiscountAmounts obj] : ["id" Data.Aeson.Types.ToJSON..= creditNoteId obj] : ["invoice" Data.Aeson.Types.ToJSON..= creditNoteInvoice obj] : ["lines" Data.Aeson.Types.ToJSON..= creditNoteLines obj] : ["livemode" Data.Aeson.Types.ToJSON..= creditNoteLivemode obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("memo" Data.Aeson.Types.ToJSON..=)) (creditNoteMemo obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("metadata" Data.Aeson.Types.ToJSON..=)) (creditNoteMetadata obj) : ["number" Data.Aeson.Types.ToJSON..= creditNoteNumber obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("out_of_band_amount" Data.Aeson.Types.ToJSON..=)) (creditNoteOutOfBandAmount obj) : ["pdf" Data.Aeson.Types.ToJSON..= creditNotePdf obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("reason" Data.Aeson.Types.ToJSON..=)) (creditNoteReason obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("refund" Data.Aeson.Types.ToJSON..=)) (creditNoteRefund obj) : ["status" Data.Aeson.Types.ToJSON..= creditNoteStatus obj] : ["subtotal" Data.Aeson.Types.ToJSON..= creditNoteSubtotal obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("subtotal_excluding_tax" Data.Aeson.Types.ToJSON..=)) (creditNoteSubtotalExcludingTax obj) : ["tax_amounts" Data.Aeson.Types.ToJSON..= creditNoteTaxAmounts obj] : ["total" Data.Aeson.Types.ToJSON..= creditNoteTotal obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("total_excluding_tax" Data.Aeson.Types.ToJSON..=)) (creditNoteTotalExcludingTax obj) : ["type" Data.Aeson.Types.ToJSON..= creditNoteType obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("voided_at" Data.Aeson.Types.ToJSON..=)) (creditNoteVoidedAt obj) : ["object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "credit_note"] : GHC.Base.mempty))) instance Data.Aeson.Types.FromJSON.FromJSON CreditNote where parseJSON = Data.Aeson.Types.FromJSON.withObject "CreditNote" (\obj -> (((((((((((((((((((((((((GHC.Base.pure CreditNote GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "created")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "customer")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "customer_balance_transaction")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "discount_amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "discount_amounts")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "id")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "invoice")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "lines")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "livemode")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "memo")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "number")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "out_of_band_amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "pdf")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "reason")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "refund")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "status")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "subtotal")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "subtotal_excluding_tax")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "tax_amounts")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "total")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "total_excluding_tax")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "type")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "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 creditNoteAmount creditNoteCreated creditNoteCurrency creditNoteCustomer creditNoteDiscountAmount creditNoteDiscountAmounts creditNoteId creditNoteInvoice creditNoteLines creditNoteLivemode creditNoteNumber creditNotePdf creditNoteStatus creditNoteSubtotal creditNoteTaxAmounts creditNoteTotal creditNoteType = CreditNote { creditNoteAmount = creditNoteAmount, creditNoteCreated = creditNoteCreated, creditNoteCurrency = creditNoteCurrency, creditNoteCustomer = creditNoteCustomer, creditNoteCustomerBalanceTransaction = GHC.Maybe.Nothing, creditNoteDiscountAmount = creditNoteDiscountAmount, creditNoteDiscountAmounts = creditNoteDiscountAmounts, creditNoteId = creditNoteId, creditNoteInvoice = creditNoteInvoice, creditNoteLines = creditNoteLines, creditNoteLivemode = creditNoteLivemode, creditNoteMemo = GHC.Maybe.Nothing, creditNoteMetadata = GHC.Maybe.Nothing, creditNoteNumber = creditNoteNumber, creditNoteOutOfBandAmount = GHC.Maybe.Nothing, creditNotePdf = creditNotePdf, creditNoteReason = GHC.Maybe.Nothing, creditNoteRefund = GHC.Maybe.Nothing, creditNoteStatus = creditNoteStatus, creditNoteSubtotal = creditNoteSubtotal, creditNoteSubtotalExcludingTax = GHC.Maybe.Nothing, creditNoteTaxAmounts = creditNoteTaxAmounts, creditNoteTotal = creditNoteTotal, creditNoteTotalExcludingTax = GHC.Maybe.Nothing, creditNoteType = creditNoteType, creditNoteVoidedAt = 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 (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteCustomer'Variants where toJSON (CreditNoteCustomer'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (CreditNoteCustomer'Customer a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (CreditNoteCustomer'DeletedCustomer a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteCustomer'Variants where parseJSON val = case (CreditNoteCustomer'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CreditNoteCustomer'Customer Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CreditNoteCustomer'DeletedCustomer Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched")) of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | 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'NonNullableVariants = CreditNoteCustomerBalanceTransaction'NonNullableText Data.Text.Internal.Text | CreditNoteCustomerBalanceTransaction'NonNullableCustomerBalanceTransaction CustomerBalanceTransaction deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteCustomerBalanceTransaction'NonNullableVariants where toJSON (CreditNoteCustomerBalanceTransaction'NonNullableText a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (CreditNoteCustomerBalanceTransaction'NonNullableCustomerBalanceTransaction a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteCustomerBalanceTransaction'NonNullableVariants where parseJSON val = case (CreditNoteCustomerBalanceTransaction'NonNullableText Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CreditNoteCustomerBalanceTransaction'NonNullableCustomerBalanceTransaction Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched") of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | 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 (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteInvoice'Variants where toJSON (CreditNoteInvoice'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (CreditNoteInvoice'Invoice a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteInvoice'Variants where parseJSON val = case (CreditNoteInvoice'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CreditNoteInvoice'Invoice Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched") of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | 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'Data :: ([CreditNoteLineItem]), -- | has_more: True if this list has another page of items after this one that can be fetched. creditNoteLines'HasMore :: GHC.Types.Bool, -- | url: The URL where this list can be accessed. -- -- Constraints: -- -- * Maximum length of 5000 creditNoteLines'Url :: Data.Text.Internal.Text } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteLines' where toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (["data" Data.Aeson.Types.ToJSON..= creditNoteLines'Data obj] : ["has_more" Data.Aeson.Types.ToJSON..= creditNoteLines'HasMore obj] : ["url" Data.Aeson.Types.ToJSON..= creditNoteLines'Url obj] : ["object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "list"] : GHC.Base.mempty)) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (["data" Data.Aeson.Types.ToJSON..= creditNoteLines'Data obj] : ["has_more" Data.Aeson.Types.ToJSON..= creditNoteLines'HasMore obj] : ["url" Data.Aeson.Types.ToJSON..= creditNoteLines'Url obj] : ["object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "list"] : GHC.Base.mempty))) instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteLines' where parseJSON = Data.Aeson.Types.FromJSON.withObject "CreditNoteLines'" (\obj -> ((GHC.Base.pure CreditNoteLines' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "data")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "has_more")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "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' creditNoteLines'Data creditNoteLines'HasMore creditNoteLines'Url = CreditNoteLines' { creditNoteLines'Data = creditNoteLines'Data, creditNoteLines'HasMore = creditNoteLines'HasMore, creditNoteLines'Url = 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'NonNullable = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. CreditNoteReason'NonNullableOther 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'NonNullableTyped Data.Text.Internal.Text | -- | Represents the JSON value @"duplicate"@ CreditNoteReason'NonNullableEnumDuplicate | -- | Represents the JSON value @"fraudulent"@ CreditNoteReason'NonNullableEnumFraudulent | -- | Represents the JSON value @"order_change"@ CreditNoteReason'NonNullableEnumOrderChange | -- | Represents the JSON value @"product_unsatisfactory"@ CreditNoteReason'NonNullableEnumProductUnsatisfactory deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteReason'NonNullable where toJSON (CreditNoteReason'NonNullableOther val) = val toJSON (CreditNoteReason'NonNullableTyped val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (CreditNoteReason'NonNullableEnumDuplicate) = "duplicate" toJSON (CreditNoteReason'NonNullableEnumFraudulent) = "fraudulent" toJSON (CreditNoteReason'NonNullableEnumOrderChange) = "order_change" toJSON (CreditNoteReason'NonNullableEnumProductUnsatisfactory) = "product_unsatisfactory" instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteReason'NonNullable where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "duplicate" -> CreditNoteReason'NonNullableEnumDuplicate | val GHC.Classes.== "fraudulent" -> CreditNoteReason'NonNullableEnumFraudulent | val GHC.Classes.== "order_change" -> CreditNoteReason'NonNullableEnumOrderChange | val GHC.Classes.== "product_unsatisfactory" -> CreditNoteReason'NonNullableEnumProductUnsatisfactory | GHC.Base.otherwise -> CreditNoteReason'NonNullableOther 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'NonNullableVariants = CreditNoteRefund'NonNullableText Data.Text.Internal.Text | CreditNoteRefund'NonNullableRefund Refund deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteRefund'NonNullableVariants where toJSON (CreditNoteRefund'NonNullableText a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (CreditNoteRefund'NonNullableRefund a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteRefund'NonNullableVariants where parseJSON val = case (CreditNoteRefund'NonNullableText Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CreditNoteRefund'NonNullableRefund Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched") of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | 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 (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteStatus' where toJSON (CreditNoteStatus'Other val) = val toJSON (CreditNoteStatus'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (CreditNoteStatus'EnumIssued) = "issued" toJSON (CreditNoteStatus'EnumVoid) = "void" instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteStatus' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "issued" -> CreditNoteStatus'EnumIssued | val GHC.Classes.== "void" -> CreditNoteStatus'EnumVoid | GHC.Base.otherwise -> CreditNoteStatus'Other 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 (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON CreditNoteType' where toJSON (CreditNoteType'Other val) = val toJSON (CreditNoteType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (CreditNoteType'EnumPostPayment) = "post_payment" toJSON (CreditNoteType'EnumPrePayment) = "pre_payment" instance Data.Aeson.Types.FromJSON.FromJSON CreditNoteType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "post_payment" -> CreditNoteType'EnumPostPayment | val GHC.Classes.== "pre_payment" -> CreditNoteType'EnumPrePayment | GHC.Base.otherwise -> CreditNoteType'Other val )