{-# 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 TaxRate module StripeAPI.Types.TaxRate 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 qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.tax_rate@ in the specification. -- -- Tax rates can be applied to [invoices](https:\/\/stripe.com\/docs\/billing\/invoices\/tax-rates), [subscriptions](https:\/\/stripe.com\/docs\/billing\/subscriptions\/taxes) and [Checkout Sessions](https:\/\/stripe.com\/docs\/payments\/checkout\/set-up-a-subscription\#tax-rates) to collect tax. -- -- Related guide: [Tax Rates](https:\/\/stripe.com\/docs\/billing\/taxes\/tax-rates). data TaxRate = TaxRate { -- | active: Defaults to \`true\`. When set to \`false\`, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set. taxRateActive :: GHC.Types.Bool, -- | country: Two-letter country code ([ISO 3166-1 alpha-2](https:\/\/en.wikipedia.org\/wiki\/ISO_3166-1_alpha-2)). -- -- Constraints: -- -- * Maximum length of 5000 taxRateCountry :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | created: Time at which the object was created. Measured in seconds since the Unix epoch. taxRateCreated :: GHC.Types.Int, -- | description: An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. -- -- Constraints: -- -- * Maximum length of 5000 taxRateDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | display_name: The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page. -- -- Constraints: -- -- * Maximum length of 5000 taxRateDisplayName :: Data.Text.Internal.Text, -- | id: Unique identifier for the object. -- -- Constraints: -- -- * Maximum length of 5000 taxRateId :: Data.Text.Internal.Text, -- | inclusive: This specifies if the tax rate is inclusive or exclusive. taxRateInclusive :: GHC.Types.Bool, -- | jurisdiction: The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice. -- -- Constraints: -- -- * Maximum length of 5000 taxRateJurisdiction :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | livemode: Has the value \`true\` if the object exists in live mode or the value \`false\` if the object exists in test mode. taxRateLivemode :: GHC.Types.Bool, -- | 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. taxRateMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object), -- | percentage: This represents the tax rate percent out of 100. taxRatePercentage :: GHC.Types.Double, -- | state: [ISO 3166-2 subdivision code](https:\/\/en.wikipedia.org\/wiki\/ISO_3166-2:US), without country prefix. For example, \"NY\" for New York, United States. -- -- Constraints: -- -- * Maximum length of 5000 taxRateState :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | tax_type: The high-level tax type, such as \`vat\` or \`sales_tax\`. taxRateTaxType :: (GHC.Maybe.Maybe TaxRateTaxType') } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON TaxRate where toJSON obj = Data.Aeson.Types.Internal.object ("active" Data.Aeson.Types.ToJSON..= taxRateActive obj : "country" Data.Aeson.Types.ToJSON..= taxRateCountry obj : "created" Data.Aeson.Types.ToJSON..= taxRateCreated obj : "description" Data.Aeson.Types.ToJSON..= taxRateDescription obj : "display_name" Data.Aeson.Types.ToJSON..= taxRateDisplayName obj : "id" Data.Aeson.Types.ToJSON..= taxRateId obj : "inclusive" Data.Aeson.Types.ToJSON..= taxRateInclusive obj : "jurisdiction" Data.Aeson.Types.ToJSON..= taxRateJurisdiction obj : "livemode" Data.Aeson.Types.ToJSON..= taxRateLivemode obj : "metadata" Data.Aeson.Types.ToJSON..= taxRateMetadata obj : "percentage" Data.Aeson.Types.ToJSON..= taxRatePercentage obj : "state" Data.Aeson.Types.ToJSON..= taxRateState obj : "tax_type" Data.Aeson.Types.ToJSON..= taxRateTaxType obj : "object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "tax_rate" : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("active" Data.Aeson.Types.ToJSON..= taxRateActive obj) GHC.Base.<> (("country" Data.Aeson.Types.ToJSON..= taxRateCountry obj) GHC.Base.<> (("created" Data.Aeson.Types.ToJSON..= taxRateCreated obj) GHC.Base.<> (("description" Data.Aeson.Types.ToJSON..= taxRateDescription obj) GHC.Base.<> (("display_name" Data.Aeson.Types.ToJSON..= taxRateDisplayName obj) GHC.Base.<> (("id" Data.Aeson.Types.ToJSON..= taxRateId obj) GHC.Base.<> (("inclusive" Data.Aeson.Types.ToJSON..= taxRateInclusive obj) GHC.Base.<> (("jurisdiction" Data.Aeson.Types.ToJSON..= taxRateJurisdiction obj) GHC.Base.<> (("livemode" Data.Aeson.Types.ToJSON..= taxRateLivemode obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= taxRateMetadata obj) GHC.Base.<> (("percentage" Data.Aeson.Types.ToJSON..= taxRatePercentage obj) GHC.Base.<> (("state" Data.Aeson.Types.ToJSON..= taxRateState obj) GHC.Base.<> (("tax_type" Data.Aeson.Types.ToJSON..= taxRateTaxType obj) GHC.Base.<> ("object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "tax_rate")))))))))))))) instance Data.Aeson.Types.FromJSON.FromJSON TaxRate where parseJSON = Data.Aeson.Types.FromJSON.withObject "TaxRate" (\obj -> ((((((((((((GHC.Base.pure TaxRate GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "active")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "country")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "created")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "description")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "display_name")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "id")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "inclusive")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "jurisdiction")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "livemode")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "percentage")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "state")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "tax_type")) -- | Create a new 'TaxRate' with all required fields. mkTaxRate :: -- | 'taxRateActive' GHC.Types.Bool -> -- | 'taxRateCreated' GHC.Types.Int -> -- | 'taxRateDisplayName' Data.Text.Internal.Text -> -- | 'taxRateId' Data.Text.Internal.Text -> -- | 'taxRateInclusive' GHC.Types.Bool -> -- | 'taxRateLivemode' GHC.Types.Bool -> -- | 'taxRatePercentage' GHC.Types.Double -> TaxRate mkTaxRate taxRateActive taxRateCreated taxRateDisplayName taxRateId taxRateInclusive taxRateLivemode taxRatePercentage = TaxRate { taxRateActive = taxRateActive, taxRateCountry = GHC.Maybe.Nothing, taxRateCreated = taxRateCreated, taxRateDescription = GHC.Maybe.Nothing, taxRateDisplayName = taxRateDisplayName, taxRateId = taxRateId, taxRateInclusive = taxRateInclusive, taxRateJurisdiction = GHC.Maybe.Nothing, taxRateLivemode = taxRateLivemode, taxRateMetadata = GHC.Maybe.Nothing, taxRatePercentage = taxRatePercentage, taxRateState = GHC.Maybe.Nothing, taxRateTaxType = GHC.Maybe.Nothing } -- | Defines the enum schema located at @components.schemas.tax_rate.properties.tax_type@ in the specification. -- -- The high-level tax type, such as \`vat\` or \`sales_tax\`. data TaxRateTaxType' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. TaxRateTaxType'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. TaxRateTaxType'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"gst"@ TaxRateTaxType'EnumGst | -- | Represents the JSON value @"hst"@ TaxRateTaxType'EnumHst | -- | Represents the JSON value @"pst"@ TaxRateTaxType'EnumPst | -- | Represents the JSON value @"qst"@ TaxRateTaxType'EnumQst | -- | Represents the JSON value @"sales_tax"@ TaxRateTaxType'EnumSalesTax | -- | Represents the JSON value @"vat"@ TaxRateTaxType'EnumVat deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON TaxRateTaxType' where toJSON (TaxRateTaxType'Other val) = val toJSON (TaxRateTaxType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (TaxRateTaxType'EnumGst) = "gst" toJSON (TaxRateTaxType'EnumHst) = "hst" toJSON (TaxRateTaxType'EnumPst) = "pst" toJSON (TaxRateTaxType'EnumQst) = "qst" toJSON (TaxRateTaxType'EnumSalesTax) = "sales_tax" toJSON (TaxRateTaxType'EnumVat) = "vat" instance Data.Aeson.Types.FromJSON.FromJSON TaxRateTaxType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "gst" -> TaxRateTaxType'EnumGst | val GHC.Classes.== "hst" -> TaxRateTaxType'EnumHst | val GHC.Classes.== "pst" -> TaxRateTaxType'EnumPst | val GHC.Classes.== "qst" -> TaxRateTaxType'EnumQst | val GHC.Classes.== "sales_tax" -> TaxRateTaxType'EnumSalesTax | val GHC.Classes.== "vat" -> TaxRateTaxType'EnumVat | GHC.Base.otherwise -> TaxRateTaxType'Other val )