{-# 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 ShippingMethod module StripeAPI.Types.ShippingMethod 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.DeliveryEstimate import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.shipping_method@ in the specification. data ShippingMethod = ShippingMethod { -- | amount: A positive integer in the smallest currency unit (that is, 100 cents for \$1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the line item. shippingMethodAmount :: 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). shippingMethodCurrency :: Data.Text.Internal.Text, -- | delivery_estimate: The estimated delivery date for the given shipping method. Can be either a specific date or a range. shippingMethodDeliveryEstimate :: (GHC.Maybe.Maybe ShippingMethodDeliveryEstimate'), -- | description: An arbitrary string attached to the object. Often useful for displaying to users. -- -- Constraints: -- -- * Maximum length of 5000 shippingMethodDescription :: Data.Text.Internal.Text, -- | id: Unique identifier for the object. -- -- Constraints: -- -- * Maximum length of 5000 shippingMethodId :: Data.Text.Internal.Text } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON ShippingMethod where toJSON obj = Data.Aeson.Types.Internal.object ("amount" Data.Aeson.Types.ToJSON..= shippingMethodAmount obj : "currency" Data.Aeson.Types.ToJSON..= shippingMethodCurrency obj : "delivery_estimate" Data.Aeson.Types.ToJSON..= shippingMethodDeliveryEstimate obj : "description" Data.Aeson.Types.ToJSON..= shippingMethodDescription obj : "id" Data.Aeson.Types.ToJSON..= shippingMethodId obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("amount" Data.Aeson.Types.ToJSON..= shippingMethodAmount obj) GHC.Base.<> (("currency" Data.Aeson.Types.ToJSON..= shippingMethodCurrency obj) GHC.Base.<> (("delivery_estimate" Data.Aeson.Types.ToJSON..= shippingMethodDeliveryEstimate obj) GHC.Base.<> (("description" Data.Aeson.Types.ToJSON..= shippingMethodDescription obj) GHC.Base.<> ("id" Data.Aeson.Types.ToJSON..= shippingMethodId obj))))) instance Data.Aeson.Types.FromJSON.FromJSON ShippingMethod where parseJSON = Data.Aeson.Types.FromJSON.withObject "ShippingMethod" (\obj -> ((((GHC.Base.pure ShippingMethod GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "delivery_estimate")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "description")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "id")) -- | Create a new 'ShippingMethod' with all required fields. mkShippingMethod :: -- | 'shippingMethodAmount' GHC.Types.Int -> -- | 'shippingMethodCurrency' Data.Text.Internal.Text -> -- | 'shippingMethodDescription' Data.Text.Internal.Text -> -- | 'shippingMethodId' Data.Text.Internal.Text -> ShippingMethod mkShippingMethod shippingMethodAmount shippingMethodCurrency shippingMethodDescription shippingMethodId = ShippingMethod { shippingMethodAmount = shippingMethodAmount, shippingMethodCurrency = shippingMethodCurrency, shippingMethodDeliveryEstimate = GHC.Maybe.Nothing, shippingMethodDescription = shippingMethodDescription, shippingMethodId = shippingMethodId } -- | Defines the object schema located at @components.schemas.shipping_method.properties.delivery_estimate.anyOf@ in the specification. -- -- The estimated delivery date for the given shipping method. Can be either a specific date or a range. data ShippingMethodDeliveryEstimate' = ShippingMethodDeliveryEstimate' { -- | date: If \`type\` is \`\"exact\"\`, \`date\` will be the expected delivery date in the format YYYY-MM-DD. -- -- Constraints: -- -- * Maximum length of 5000 shippingMethodDeliveryEstimate'Date :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | earliest: If \`type\` is \`\"range\"\`, \`earliest\` will be be the earliest delivery date in the format YYYY-MM-DD. -- -- Constraints: -- -- * Maximum length of 5000 shippingMethodDeliveryEstimate'Earliest :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | latest: If \`type\` is \`\"range\"\`, \`latest\` will be the latest delivery date in the format YYYY-MM-DD. -- -- Constraints: -- -- * Maximum length of 5000 shippingMethodDeliveryEstimate'Latest :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | type: The type of estimate. Must be either \`\"range\"\` or \`\"exact\"\`. -- -- Constraints: -- -- * Maximum length of 5000 shippingMethodDeliveryEstimate'Type :: (GHC.Maybe.Maybe Data.Text.Internal.Text) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON ShippingMethodDeliveryEstimate' where toJSON obj = Data.Aeson.Types.Internal.object ("date" Data.Aeson.Types.ToJSON..= shippingMethodDeliveryEstimate'Date obj : "earliest" Data.Aeson.Types.ToJSON..= shippingMethodDeliveryEstimate'Earliest obj : "latest" Data.Aeson.Types.ToJSON..= shippingMethodDeliveryEstimate'Latest obj : "type" Data.Aeson.Types.ToJSON..= shippingMethodDeliveryEstimate'Type obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("date" Data.Aeson.Types.ToJSON..= shippingMethodDeliveryEstimate'Date obj) GHC.Base.<> (("earliest" Data.Aeson.Types.ToJSON..= shippingMethodDeliveryEstimate'Earliest obj) GHC.Base.<> (("latest" Data.Aeson.Types.ToJSON..= shippingMethodDeliveryEstimate'Latest obj) GHC.Base.<> ("type" Data.Aeson.Types.ToJSON..= shippingMethodDeliveryEstimate'Type obj)))) instance Data.Aeson.Types.FromJSON.FromJSON ShippingMethodDeliveryEstimate' where parseJSON = Data.Aeson.Types.FromJSON.withObject "ShippingMethodDeliveryEstimate'" (\obj -> (((GHC.Base.pure ShippingMethodDeliveryEstimate' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "date")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "earliest")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "latest")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "type")) -- | Create a new 'ShippingMethodDeliveryEstimate'' with all required fields. mkShippingMethodDeliveryEstimate' :: ShippingMethodDeliveryEstimate' mkShippingMethodDeliveryEstimate' = ShippingMethodDeliveryEstimate' { shippingMethodDeliveryEstimate'Date = GHC.Maybe.Nothing, shippingMethodDeliveryEstimate'Earliest = GHC.Maybe.Nothing, shippingMethodDeliveryEstimate'Latest = GHC.Maybe.Nothing, shippingMethodDeliveryEstimate'Type = GHC.Maybe.Nothing }