{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.OnlineAcceptance 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 OnlineAcceptance = OnlineAcceptance
{
OnlineAcceptance -> Maybe Text
onlineAcceptanceIpAddress :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
OnlineAcceptance -> Maybe Text
onlineAcceptanceUserAgent :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> OnlineAcceptance -> ShowS
[OnlineAcceptance] -> ShowS
OnlineAcceptance -> String
(Int -> OnlineAcceptance -> ShowS)
-> (OnlineAcceptance -> String)
-> ([OnlineAcceptance] -> ShowS)
-> Show OnlineAcceptance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OnlineAcceptance] -> ShowS
$cshowList :: [OnlineAcceptance] -> ShowS
show :: OnlineAcceptance -> String
$cshow :: OnlineAcceptance -> String
showsPrec :: Int -> OnlineAcceptance -> ShowS
$cshowsPrec :: Int -> OnlineAcceptance -> ShowS
GHC.Show.Show,
OnlineAcceptance -> OnlineAcceptance -> Bool
(OnlineAcceptance -> OnlineAcceptance -> Bool)
-> (OnlineAcceptance -> OnlineAcceptance -> Bool)
-> Eq OnlineAcceptance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OnlineAcceptance -> OnlineAcceptance -> Bool
$c/= :: OnlineAcceptance -> OnlineAcceptance -> Bool
== :: OnlineAcceptance -> OnlineAcceptance -> Bool
$c== :: OnlineAcceptance -> OnlineAcceptance -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON OnlineAcceptance where
toJSON :: OnlineAcceptance -> Value
toJSON OnlineAcceptance
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"ip_address" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= OnlineAcceptance -> Maybe Text
onlineAcceptanceIpAddress OnlineAcceptance
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"user_agent" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= OnlineAcceptance -> Maybe Text
onlineAcceptanceUserAgent OnlineAcceptance
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: OnlineAcceptance -> Encoding
toEncoding OnlineAcceptance
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"ip_address" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= OnlineAcceptance -> Maybe Text
onlineAcceptanceIpAddress OnlineAcceptance
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"user_agent" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= OnlineAcceptance -> Maybe Text
onlineAcceptanceUserAgent OnlineAcceptance
obj))
instance Data.Aeson.Types.FromJSON.FromJSON OnlineAcceptance where
parseJSON :: Value -> Parser OnlineAcceptance
parseJSON = String
-> (Object -> Parser OnlineAcceptance)
-> Value
-> Parser OnlineAcceptance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"OnlineAcceptance" (\Object
obj -> ((Maybe Text -> Maybe Text -> OnlineAcceptance)
-> Parser (Maybe Text -> Maybe Text -> OnlineAcceptance)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text -> Maybe Text -> OnlineAcceptance
OnlineAcceptance Parser (Maybe Text -> Maybe Text -> OnlineAcceptance)
-> Parser (Maybe Text) -> Parser (Maybe Text -> OnlineAcceptance)
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
"ip_address")) Parser (Maybe Text -> OnlineAcceptance)
-> Parser (Maybe Text) -> Parser OnlineAcceptance
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
"user_agent"))
mkOnlineAcceptance :: OnlineAcceptance
mkOnlineAcceptance :: OnlineAcceptance
mkOnlineAcceptance =
OnlineAcceptance :: Maybe Text -> Maybe Text -> OnlineAcceptance
OnlineAcceptance
{ onlineAcceptanceIpAddress :: Maybe Text
onlineAcceptanceIpAddress = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
onlineAcceptanceUserAgent :: Maybe Text
onlineAcceptanceUserAgent = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}