{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
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
data ShippingMethod = ShippingMethod
{
ShippingMethod -> Int
shippingMethodAmount :: GHC.Types.Int,
ShippingMethod -> Text
shippingMethodCurrency :: Data.Text.Internal.Text,
ShippingMethod -> Maybe ShippingMethodDeliveryEstimate'
shippingMethodDeliveryEstimate :: (GHC.Maybe.Maybe ShippingMethodDeliveryEstimate'),
ShippingMethod -> Text
shippingMethodDescription :: Data.Text.Internal.Text,
ShippingMethod -> Text
shippingMethodId :: Data.Text.Internal.Text
}
deriving
( Int -> ShippingMethod -> ShowS
[ShippingMethod] -> ShowS
ShippingMethod -> String
(Int -> ShippingMethod -> ShowS)
-> (ShippingMethod -> String)
-> ([ShippingMethod] -> ShowS)
-> Show ShippingMethod
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShippingMethod] -> ShowS
$cshowList :: [ShippingMethod] -> ShowS
show :: ShippingMethod -> String
$cshow :: ShippingMethod -> String
showsPrec :: Int -> ShippingMethod -> ShowS
$cshowsPrec :: Int -> ShippingMethod -> ShowS
GHC.Show.Show,
ShippingMethod -> ShippingMethod -> Bool
(ShippingMethod -> ShippingMethod -> Bool)
-> (ShippingMethod -> ShippingMethod -> Bool) -> Eq ShippingMethod
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShippingMethod -> ShippingMethod -> Bool
$c/= :: ShippingMethod -> ShippingMethod -> Bool
== :: ShippingMethod -> ShippingMethod -> Bool
$c== :: ShippingMethod -> ShippingMethod -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON ShippingMethod where
toJSON :: ShippingMethod -> Value
toJSON ShippingMethod
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..= ShippingMethod -> Int
shippingMethodAmount ShippingMethod
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..= ShippingMethod -> Text
shippingMethodCurrency ShippingMethod
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"delivery_estimate" Text -> Maybe ShippingMethodDeliveryEstimate' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethod -> Maybe ShippingMethodDeliveryEstimate'
shippingMethodDeliveryEstimate ShippingMethod
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethod -> Text
shippingMethodDescription ShippingMethod
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..= ShippingMethod -> Text
shippingMethodId ShippingMethod
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: ShippingMethod -> Encoding
toEncoding ShippingMethod
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..= ShippingMethod -> Int
shippingMethodAmount ShippingMethod
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..= ShippingMethod -> Text
shippingMethodCurrency ShippingMethod
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"delivery_estimate" Text -> Maybe ShippingMethodDeliveryEstimate' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethod -> Maybe ShippingMethodDeliveryEstimate'
shippingMethodDeliveryEstimate ShippingMethod
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"description" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethod -> Text
shippingMethodDescription ShippingMethod
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..= ShippingMethod -> Text
shippingMethodId ShippingMethod
obj)))))
instance Data.Aeson.Types.FromJSON.FromJSON ShippingMethod where
parseJSON :: Value -> Parser ShippingMethod
parseJSON = String
-> (Object -> Parser ShippingMethod)
-> Value
-> Parser ShippingMethod
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"ShippingMethod" (\Object
obj -> (((((Int
-> Text
-> Maybe ShippingMethodDeliveryEstimate'
-> Text
-> Text
-> ShippingMethod)
-> Parser
(Int
-> Text
-> Maybe ShippingMethodDeliveryEstimate'
-> Text
-> Text
-> ShippingMethod)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Int
-> Text
-> Maybe ShippingMethodDeliveryEstimate'
-> Text
-> Text
-> ShippingMethod
ShippingMethod Parser
(Int
-> Text
-> Maybe ShippingMethodDeliveryEstimate'
-> Text
-> Text
-> ShippingMethod)
-> Parser Int
-> Parser
(Text
-> Maybe ShippingMethodDeliveryEstimate'
-> Text
-> Text
-> ShippingMethod)
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
(Text
-> Maybe ShippingMethodDeliveryEstimate'
-> Text
-> Text
-> ShippingMethod)
-> Parser Text
-> Parser
(Maybe ShippingMethodDeliveryEstimate'
-> Text -> Text -> ShippingMethod)
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
(Maybe ShippingMethodDeliveryEstimate'
-> Text -> Text -> ShippingMethod)
-> Parser (Maybe ShippingMethodDeliveryEstimate')
-> Parser (Text -> Text -> ShippingMethod)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ShippingMethodDeliveryEstimate')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"delivery_estimate")) Parser (Text -> Text -> ShippingMethod)
-> Parser Text -> Parser (Text -> ShippingMethod)
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
"description")) Parser (Text -> ShippingMethod)
-> Parser Text -> Parser ShippingMethod
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"))
mkShippingMethod ::
GHC.Types.Int ->
Data.Text.Internal.Text ->
Data.Text.Internal.Text ->
Data.Text.Internal.Text ->
ShippingMethod
mkShippingMethod :: Int -> Text -> Text -> Text -> ShippingMethod
mkShippingMethod Int
shippingMethodAmount Text
shippingMethodCurrency Text
shippingMethodDescription Text
shippingMethodId =
ShippingMethod :: Int
-> Text
-> Maybe ShippingMethodDeliveryEstimate'
-> Text
-> Text
-> ShippingMethod
ShippingMethod
{ shippingMethodAmount :: Int
shippingMethodAmount = Int
shippingMethodAmount,
shippingMethodCurrency :: Text
shippingMethodCurrency = Text
shippingMethodCurrency,
shippingMethodDeliveryEstimate :: Maybe ShippingMethodDeliveryEstimate'
shippingMethodDeliveryEstimate = Maybe ShippingMethodDeliveryEstimate'
forall a. Maybe a
GHC.Maybe.Nothing,
shippingMethodDescription :: Text
shippingMethodDescription = Text
shippingMethodDescription,
shippingMethodId :: Text
shippingMethodId = Text
shippingMethodId
}
data ShippingMethodDeliveryEstimate' = ShippingMethodDeliveryEstimate'
{
ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Date :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Earliest :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Latest :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Type :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> ShippingMethodDeliveryEstimate' -> ShowS
[ShippingMethodDeliveryEstimate'] -> ShowS
ShippingMethodDeliveryEstimate' -> String
(Int -> ShippingMethodDeliveryEstimate' -> ShowS)
-> (ShippingMethodDeliveryEstimate' -> String)
-> ([ShippingMethodDeliveryEstimate'] -> ShowS)
-> Show ShippingMethodDeliveryEstimate'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShippingMethodDeliveryEstimate'] -> ShowS
$cshowList :: [ShippingMethodDeliveryEstimate'] -> ShowS
show :: ShippingMethodDeliveryEstimate' -> String
$cshow :: ShippingMethodDeliveryEstimate' -> String
showsPrec :: Int -> ShippingMethodDeliveryEstimate' -> ShowS
$cshowsPrec :: Int -> ShippingMethodDeliveryEstimate' -> ShowS
GHC.Show.Show,
ShippingMethodDeliveryEstimate'
-> ShippingMethodDeliveryEstimate' -> Bool
(ShippingMethodDeliveryEstimate'
-> ShippingMethodDeliveryEstimate' -> Bool)
-> (ShippingMethodDeliveryEstimate'
-> ShippingMethodDeliveryEstimate' -> Bool)
-> Eq ShippingMethodDeliveryEstimate'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShippingMethodDeliveryEstimate'
-> ShippingMethodDeliveryEstimate' -> Bool
$c/= :: ShippingMethodDeliveryEstimate'
-> ShippingMethodDeliveryEstimate' -> Bool
== :: ShippingMethodDeliveryEstimate'
-> ShippingMethodDeliveryEstimate' -> Bool
$c== :: ShippingMethodDeliveryEstimate'
-> ShippingMethodDeliveryEstimate' -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON ShippingMethodDeliveryEstimate' where
toJSON :: ShippingMethodDeliveryEstimate' -> Value
toJSON ShippingMethodDeliveryEstimate'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"date" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Date ShippingMethodDeliveryEstimate'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"earliest" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Earliest ShippingMethodDeliveryEstimate'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"latest" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Latest ShippingMethodDeliveryEstimate'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Type ShippingMethodDeliveryEstimate'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: ShippingMethodDeliveryEstimate' -> Encoding
toEncoding ShippingMethodDeliveryEstimate'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"date" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Date ShippingMethodDeliveryEstimate'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"earliest" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Earliest ShippingMethodDeliveryEstimate'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"latest" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Latest ShippingMethodDeliveryEstimate'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"type" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ShippingMethodDeliveryEstimate' -> Maybe Text
shippingMethodDeliveryEstimate'Type ShippingMethodDeliveryEstimate'
obj))))
instance Data.Aeson.Types.FromJSON.FromJSON ShippingMethodDeliveryEstimate' where
parseJSON :: Value -> Parser ShippingMethodDeliveryEstimate'
parseJSON = String
-> (Object -> Parser ShippingMethodDeliveryEstimate')
-> Value
-> Parser ShippingMethodDeliveryEstimate'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"ShippingMethodDeliveryEstimate'" (\Object
obj -> ((((Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ShippingMethodDeliveryEstimate')
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ShippingMethodDeliveryEstimate')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ShippingMethodDeliveryEstimate'
ShippingMethodDeliveryEstimate' Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ShippingMethodDeliveryEstimate')
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> ShippingMethodDeliveryEstimate')
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
"date")) Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> ShippingMethodDeliveryEstimate')
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> ShippingMethodDeliveryEstimate')
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
"earliest")) Parser
(Maybe Text -> Maybe Text -> ShippingMethodDeliveryEstimate')
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ShippingMethodDeliveryEstimate')
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
"latest")) Parser (Maybe Text -> ShippingMethodDeliveryEstimate')
-> Parser (Maybe Text) -> Parser ShippingMethodDeliveryEstimate'
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
"type"))
mkShippingMethodDeliveryEstimate' :: ShippingMethodDeliveryEstimate'
mkShippingMethodDeliveryEstimate' :: ShippingMethodDeliveryEstimate'
mkShippingMethodDeliveryEstimate' =
ShippingMethodDeliveryEstimate' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ShippingMethodDeliveryEstimate'
ShippingMethodDeliveryEstimate'
{ shippingMethodDeliveryEstimate'Date :: Maybe Text
shippingMethodDeliveryEstimate'Date = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
shippingMethodDeliveryEstimate'Earliest :: Maybe Text
shippingMethodDeliveryEstimate'Earliest = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
shippingMethodDeliveryEstimate'Latest :: Maybe Text
shippingMethodDeliveryEstimate'Latest = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
shippingMethodDeliveryEstimate'Type :: Maybe Text
shippingMethodDeliveryEstimate'Type = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}