{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.GelatoSessionLastError 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
data GelatoSessionLastError = GelatoSessionLastError
{
GelatoSessionLastError -> Maybe GelatoSessionLastErrorCode'
gelatoSessionLastErrorCode :: (GHC.Maybe.Maybe GelatoSessionLastErrorCode'),
GelatoSessionLastError -> Maybe Text
gelatoSessionLastErrorReason :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> GelatoSessionLastError -> ShowS
[GelatoSessionLastError] -> ShowS
GelatoSessionLastError -> String
(Int -> GelatoSessionLastError -> ShowS)
-> (GelatoSessionLastError -> String)
-> ([GelatoSessionLastError] -> ShowS)
-> Show GelatoSessionLastError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GelatoSessionLastError] -> ShowS
$cshowList :: [GelatoSessionLastError] -> ShowS
show :: GelatoSessionLastError -> String
$cshow :: GelatoSessionLastError -> String
showsPrec :: Int -> GelatoSessionLastError -> ShowS
$cshowsPrec :: Int -> GelatoSessionLastError -> ShowS
GHC.Show.Show,
GelatoSessionLastError -> GelatoSessionLastError -> Bool
(GelatoSessionLastError -> GelatoSessionLastError -> Bool)
-> (GelatoSessionLastError -> GelatoSessionLastError -> Bool)
-> Eq GelatoSessionLastError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GelatoSessionLastError -> GelatoSessionLastError -> Bool
$c/= :: GelatoSessionLastError -> GelatoSessionLastError -> Bool
== :: GelatoSessionLastError -> GelatoSessionLastError -> Bool
$c== :: GelatoSessionLastError -> GelatoSessionLastError -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON GelatoSessionLastError where
toJSON :: GelatoSessionLastError -> Value
toJSON GelatoSessionLastError
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"code" Text -> Maybe GelatoSessionLastErrorCode' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoSessionLastError -> Maybe GelatoSessionLastErrorCode'
gelatoSessionLastErrorCode GelatoSessionLastError
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"reason" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoSessionLastError -> Maybe Text
gelatoSessionLastErrorReason GelatoSessionLastError
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: GelatoSessionLastError -> Encoding
toEncoding GelatoSessionLastError
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"code" Text -> Maybe GelatoSessionLastErrorCode' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoSessionLastError -> Maybe GelatoSessionLastErrorCode'
gelatoSessionLastErrorCode GelatoSessionLastError
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"reason" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoSessionLastError -> Maybe Text
gelatoSessionLastErrorReason GelatoSessionLastError
obj))
instance Data.Aeson.Types.FromJSON.FromJSON GelatoSessionLastError where
parseJSON :: Value -> Parser GelatoSessionLastError
parseJSON = String
-> (Object -> Parser GelatoSessionLastError)
-> Value
-> Parser GelatoSessionLastError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GelatoSessionLastError" (\Object
obj -> ((Maybe GelatoSessionLastErrorCode'
-> Maybe Text -> GelatoSessionLastError)
-> Parser
(Maybe GelatoSessionLastErrorCode'
-> Maybe Text -> GelatoSessionLastError)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe GelatoSessionLastErrorCode'
-> Maybe Text -> GelatoSessionLastError
GelatoSessionLastError Parser
(Maybe GelatoSessionLastErrorCode'
-> Maybe Text -> GelatoSessionLastError)
-> Parser (Maybe GelatoSessionLastErrorCode')
-> Parser (Maybe Text -> GelatoSessionLastError)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe GelatoSessionLastErrorCode')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"code")) Parser (Maybe Text -> GelatoSessionLastError)
-> Parser (Maybe Text) -> Parser GelatoSessionLastError
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
"reason"))
mkGelatoSessionLastError :: GelatoSessionLastError
mkGelatoSessionLastError :: GelatoSessionLastError
mkGelatoSessionLastError =
GelatoSessionLastError :: Maybe GelatoSessionLastErrorCode'
-> Maybe Text -> GelatoSessionLastError
GelatoSessionLastError
{ gelatoSessionLastErrorCode :: Maybe GelatoSessionLastErrorCode'
gelatoSessionLastErrorCode = Maybe GelatoSessionLastErrorCode'
forall a. Maybe a
GHC.Maybe.Nothing,
gelatoSessionLastErrorReason :: Maybe Text
gelatoSessionLastErrorReason = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}
data GelatoSessionLastErrorCode'
=
GelatoSessionLastErrorCode'Other Data.Aeson.Types.Internal.Value
|
GelatoSessionLastErrorCode'Typed Data.Text.Internal.Text
|
GelatoSessionLastErrorCode'EnumAbandoned
|
GelatoSessionLastErrorCode'EnumConsentDeclined
|
GelatoSessionLastErrorCode'EnumCountryNotSupported
|
GelatoSessionLastErrorCode'EnumDeviceNotSupported
|
GelatoSessionLastErrorCode'EnumDocumentExpired
|
GelatoSessionLastErrorCode'EnumDocumentTypeNotSupported
|
GelatoSessionLastErrorCode'EnumDocumentUnverifiedOther
|
GelatoSessionLastErrorCode'EnumIdNumberInsufficientDocumentData
|
GelatoSessionLastErrorCode'EnumIdNumberMismatch
|
GelatoSessionLastErrorCode'EnumIdNumberUnverifiedOther
|
GelatoSessionLastErrorCode'EnumSelfieDocumentMissingPhoto
|
GelatoSessionLastErrorCode'EnumSelfieFaceMismatch
|
GelatoSessionLastErrorCode'EnumSelfieManipulated
|
GelatoSessionLastErrorCode'EnumSelfieUnverifiedOther
|
GelatoSessionLastErrorCode'EnumUnderSupportedAge
deriving (Int -> GelatoSessionLastErrorCode' -> ShowS
[GelatoSessionLastErrorCode'] -> ShowS
GelatoSessionLastErrorCode' -> String
(Int -> GelatoSessionLastErrorCode' -> ShowS)
-> (GelatoSessionLastErrorCode' -> String)
-> ([GelatoSessionLastErrorCode'] -> ShowS)
-> Show GelatoSessionLastErrorCode'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GelatoSessionLastErrorCode'] -> ShowS
$cshowList :: [GelatoSessionLastErrorCode'] -> ShowS
show :: GelatoSessionLastErrorCode' -> String
$cshow :: GelatoSessionLastErrorCode' -> String
showsPrec :: Int -> GelatoSessionLastErrorCode' -> ShowS
$cshowsPrec :: Int -> GelatoSessionLastErrorCode' -> ShowS
GHC.Show.Show, GelatoSessionLastErrorCode' -> GelatoSessionLastErrorCode' -> Bool
(GelatoSessionLastErrorCode'
-> GelatoSessionLastErrorCode' -> Bool)
-> (GelatoSessionLastErrorCode'
-> GelatoSessionLastErrorCode' -> Bool)
-> Eq GelatoSessionLastErrorCode'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GelatoSessionLastErrorCode' -> GelatoSessionLastErrorCode' -> Bool
$c/= :: GelatoSessionLastErrorCode' -> GelatoSessionLastErrorCode' -> Bool
== :: GelatoSessionLastErrorCode' -> GelatoSessionLastErrorCode' -> Bool
$c== :: GelatoSessionLastErrorCode' -> GelatoSessionLastErrorCode' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON GelatoSessionLastErrorCode' where
toJSON :: GelatoSessionLastErrorCode' -> Value
toJSON (GelatoSessionLastErrorCode'Other Value
val) = Value
val
toJSON (GelatoSessionLastErrorCode'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumAbandoned) = Value
"abandoned"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumConsentDeclined) = Value
"consent_declined"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumCountryNotSupported) = Value
"country_not_supported"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumDeviceNotSupported) = Value
"device_not_supported"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumDocumentExpired) = Value
"document_expired"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumDocumentTypeNotSupported) = Value
"document_type_not_supported"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumDocumentUnverifiedOther) = Value
"document_unverified_other"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumIdNumberInsufficientDocumentData) = Value
"id_number_insufficient_document_data"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumIdNumberMismatch) = Value
"id_number_mismatch"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumIdNumberUnverifiedOther) = Value
"id_number_unverified_other"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumSelfieDocumentMissingPhoto) = Value
"selfie_document_missing_photo"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumSelfieFaceMismatch) = Value
"selfie_face_mismatch"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumSelfieManipulated) = Value
"selfie_manipulated"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumSelfieUnverifiedOther) = Value
"selfie_unverified_other"
toJSON (GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumUnderSupportedAge) = Value
"under_supported_age"
instance Data.Aeson.Types.FromJSON.FromJSON GelatoSessionLastErrorCode' where
parseJSON :: Value -> Parser GelatoSessionLastErrorCode'
parseJSON Value
val =
GelatoSessionLastErrorCode' -> Parser GelatoSessionLastErrorCode'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"abandoned" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumAbandoned
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"consent_declined" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumConsentDeclined
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"country_not_supported" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumCountryNotSupported
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"device_not_supported" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumDeviceNotSupported
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"document_expired" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumDocumentExpired
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"document_type_not_supported" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumDocumentTypeNotSupported
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"document_unverified_other" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumDocumentUnverifiedOther
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"id_number_insufficient_document_data" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumIdNumberInsufficientDocumentData
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"id_number_mismatch" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumIdNumberMismatch
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"id_number_unverified_other" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumIdNumberUnverifiedOther
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"selfie_document_missing_photo" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumSelfieDocumentMissingPhoto
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"selfie_face_mismatch" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumSelfieFaceMismatch
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"selfie_manipulated" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumSelfieManipulated
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"selfie_unverified_other" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumSelfieUnverifiedOther
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"under_supported_age" -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'EnumUnderSupportedAge
| Bool
GHC.Base.otherwise -> Value -> GelatoSessionLastErrorCode'
GelatoSessionLastErrorCode'Other Value
val
)