{-# 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 CustomerTax module StripeAPI.Types.CustomerTax 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.CustomerTaxLocation import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.customer_tax@ in the specification. data CustomerTax = CustomerTax { -- | automatic_tax: Surfaces if automatic tax computation is possible given the current customer location information. customerTaxAutomaticTax :: CustomerTaxAutomaticTax', -- | ip_address: A recent IP address of the customer used for tax reporting and tax location inference. -- -- Constraints: -- -- * Maximum length of 5000 customerTaxIpAddress :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | location: The customer\'s location as identified by Stripe Tax. customerTaxLocation :: (GHC.Maybe.Maybe CustomerTaxLocation') } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON CustomerTax where toJSON obj = Data.Aeson.Types.Internal.object ("automatic_tax" Data.Aeson.Types.ToJSON..= customerTaxAutomaticTax obj : "ip_address" Data.Aeson.Types.ToJSON..= customerTaxIpAddress obj : "location" Data.Aeson.Types.ToJSON..= customerTaxLocation obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("automatic_tax" Data.Aeson.Types.ToJSON..= customerTaxAutomaticTax obj) GHC.Base.<> (("ip_address" Data.Aeson.Types.ToJSON..= customerTaxIpAddress obj) GHC.Base.<> ("location" Data.Aeson.Types.ToJSON..= customerTaxLocation obj))) instance Data.Aeson.Types.FromJSON.FromJSON CustomerTax where parseJSON = Data.Aeson.Types.FromJSON.withObject "CustomerTax" (\obj -> ((GHC.Base.pure CustomerTax GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "automatic_tax")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "ip_address")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "location")) -- | Create a new 'CustomerTax' with all required fields. mkCustomerTax :: -- | 'customerTaxAutomaticTax' CustomerTaxAutomaticTax' -> CustomerTax mkCustomerTax customerTaxAutomaticTax = CustomerTax { customerTaxAutomaticTax = customerTaxAutomaticTax, customerTaxIpAddress = GHC.Maybe.Nothing, customerTaxLocation = GHC.Maybe.Nothing } -- | Defines the enum schema located at @components.schemas.customer_tax.properties.automatic_tax@ in the specification. -- -- Surfaces if automatic tax computation is possible given the current customer location information. data CustomerTaxAutomaticTax' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. CustomerTaxAutomaticTax'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. CustomerTaxAutomaticTax'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"failed"@ CustomerTaxAutomaticTax'EnumFailed | -- | Represents the JSON value @"not_collecting"@ CustomerTaxAutomaticTax'EnumNotCollecting | -- | Represents the JSON value @"supported"@ CustomerTaxAutomaticTax'EnumSupported | -- | Represents the JSON value @"unrecognized_location"@ CustomerTaxAutomaticTax'EnumUnrecognizedLocation deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON CustomerTaxAutomaticTax' where toJSON (CustomerTaxAutomaticTax'Other val) = val toJSON (CustomerTaxAutomaticTax'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (CustomerTaxAutomaticTax'EnumFailed) = "failed" toJSON (CustomerTaxAutomaticTax'EnumNotCollecting) = "not_collecting" toJSON (CustomerTaxAutomaticTax'EnumSupported) = "supported" toJSON (CustomerTaxAutomaticTax'EnumUnrecognizedLocation) = "unrecognized_location" instance Data.Aeson.Types.FromJSON.FromJSON CustomerTaxAutomaticTax' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "failed" -> CustomerTaxAutomaticTax'EnumFailed | val GHC.Classes.== "not_collecting" -> CustomerTaxAutomaticTax'EnumNotCollecting | val GHC.Classes.== "supported" -> CustomerTaxAutomaticTax'EnumSupported | val GHC.Classes.== "unrecognized_location" -> CustomerTaxAutomaticTax'EnumUnrecognizedLocation | GHC.Base.otherwise -> CustomerTaxAutomaticTax'Other val ) -- | Defines the object schema located at @components.schemas.customer_tax.properties.location.anyOf@ in the specification. -- -- The customer\\\'s location as identified by Stripe Tax. data CustomerTaxLocation' = CustomerTaxLocation' { -- | country: The customer\'s country as identified by Stripe Tax. -- -- Constraints: -- -- * Maximum length of 5000 customerTaxLocation'Country :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | source: The data source used to infer the customer\'s location. customerTaxLocation'Source :: (GHC.Maybe.Maybe CustomerTaxLocation'Source'), -- | state: The customer\'s state, county, province, or region as identified by Stripe Tax. -- -- Constraints: -- -- * Maximum length of 5000 customerTaxLocation'State :: (GHC.Maybe.Maybe Data.Text.Internal.Text) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON CustomerTaxLocation' where toJSON obj = Data.Aeson.Types.Internal.object ("country" Data.Aeson.Types.ToJSON..= customerTaxLocation'Country obj : "source" Data.Aeson.Types.ToJSON..= customerTaxLocation'Source obj : "state" Data.Aeson.Types.ToJSON..= customerTaxLocation'State obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("country" Data.Aeson.Types.ToJSON..= customerTaxLocation'Country obj) GHC.Base.<> (("source" Data.Aeson.Types.ToJSON..= customerTaxLocation'Source obj) GHC.Base.<> ("state" Data.Aeson.Types.ToJSON..= customerTaxLocation'State obj))) instance Data.Aeson.Types.FromJSON.FromJSON CustomerTaxLocation' where parseJSON = Data.Aeson.Types.FromJSON.withObject "CustomerTaxLocation'" (\obj -> ((GHC.Base.pure CustomerTaxLocation' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "country")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "source")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "state")) -- | Create a new 'CustomerTaxLocation'' with all required fields. mkCustomerTaxLocation' :: CustomerTaxLocation' mkCustomerTaxLocation' = CustomerTaxLocation' { customerTaxLocation'Country = GHC.Maybe.Nothing, customerTaxLocation'Source = GHC.Maybe.Nothing, customerTaxLocation'State = GHC.Maybe.Nothing } -- | Defines the enum schema located at @components.schemas.customer_tax.properties.location.anyOf.properties.source@ in the specification. -- -- The data source used to infer the customer\'s location. data CustomerTaxLocation'Source' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. CustomerTaxLocation'Source'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. CustomerTaxLocation'Source'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"billing_address"@ CustomerTaxLocation'Source'EnumBillingAddress | -- | Represents the JSON value @"ip_address"@ CustomerTaxLocation'Source'EnumIpAddress | -- | Represents the JSON value @"payment_method"@ CustomerTaxLocation'Source'EnumPaymentMethod | -- | Represents the JSON value @"shipping_destination"@ CustomerTaxLocation'Source'EnumShippingDestination deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON CustomerTaxLocation'Source' where toJSON (CustomerTaxLocation'Source'Other val) = val toJSON (CustomerTaxLocation'Source'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (CustomerTaxLocation'Source'EnumBillingAddress) = "billing_address" toJSON (CustomerTaxLocation'Source'EnumIpAddress) = "ip_address" toJSON (CustomerTaxLocation'Source'EnumPaymentMethod) = "payment_method" toJSON (CustomerTaxLocation'Source'EnumShippingDestination) = "shipping_destination" instance Data.Aeson.Types.FromJSON.FromJSON CustomerTaxLocation'Source' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "billing_address" -> CustomerTaxLocation'Source'EnumBillingAddress | val GHC.Classes.== "ip_address" -> CustomerTaxLocation'Source'EnumIpAddress | val GHC.Classes.== "payment_method" -> CustomerTaxLocation'Source'EnumPaymentMethod | val GHC.Classes.== "shipping_destination" -> CustomerTaxLocation'Source'EnumShippingDestination | GHC.Base.otherwise -> CustomerTaxLocation'Source'Other val )