{-# 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 CustomerAcceptance module StripeAPI.Types.CustomerAcceptance 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.OnlineAcceptance import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.customer_acceptance@ in the specification. data CustomerAcceptance = CustomerAcceptance { -- | accepted_at: The time at which the customer accepted the Mandate. customerAcceptanceAcceptedAt :: (GHC.Maybe.Maybe GHC.Types.Int), -- | offline: customerAcceptanceOffline :: (GHC.Maybe.Maybe OfflineAcceptance), -- | online: customerAcceptanceOnline :: (GHC.Maybe.Maybe OnlineAcceptance), -- | type: The type of customer acceptance information included with the Mandate. One of \`online\` or \`offline\`. customerAcceptanceType :: CustomerAcceptanceType' } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON CustomerAcceptance where toJSON obj = Data.Aeson.Types.Internal.object ("accepted_at" Data.Aeson.Types.ToJSON..= customerAcceptanceAcceptedAt obj : "offline" Data.Aeson.Types.ToJSON..= customerAcceptanceOffline obj : "online" Data.Aeson.Types.ToJSON..= customerAcceptanceOnline obj : "type" Data.Aeson.Types.ToJSON..= customerAcceptanceType obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("accepted_at" Data.Aeson.Types.ToJSON..= customerAcceptanceAcceptedAt obj) GHC.Base.<> (("offline" Data.Aeson.Types.ToJSON..= customerAcceptanceOffline obj) GHC.Base.<> (("online" Data.Aeson.Types.ToJSON..= customerAcceptanceOnline obj) GHC.Base.<> ("type" Data.Aeson.Types.ToJSON..= customerAcceptanceType obj)))) instance Data.Aeson.Types.FromJSON.FromJSON CustomerAcceptance where parseJSON = Data.Aeson.Types.FromJSON.withObject "CustomerAcceptance" (\obj -> (((GHC.Base.pure CustomerAcceptance GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "accepted_at")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "offline")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "online")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "type")) -- | Create a new 'CustomerAcceptance' with all required fields. mkCustomerAcceptance :: -- | 'customerAcceptanceType' CustomerAcceptanceType' -> CustomerAcceptance mkCustomerAcceptance customerAcceptanceType = CustomerAcceptance { customerAcceptanceAcceptedAt = GHC.Maybe.Nothing, customerAcceptanceOffline = GHC.Maybe.Nothing, customerAcceptanceOnline = GHC.Maybe.Nothing, customerAcceptanceType = customerAcceptanceType } -- | Defines the enum schema located at @components.schemas.customer_acceptance.properties.type@ in the specification. -- -- The type of customer acceptance information included with the Mandate. One of \`online\` or \`offline\`. data CustomerAcceptanceType' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. CustomerAcceptanceType'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. CustomerAcceptanceType'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"offline"@ CustomerAcceptanceType'EnumOffline | -- | Represents the JSON value @"online"@ CustomerAcceptanceType'EnumOnline deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON CustomerAcceptanceType' where toJSON (CustomerAcceptanceType'Other val) = val toJSON (CustomerAcceptanceType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (CustomerAcceptanceType'EnumOffline) = "offline" toJSON (CustomerAcceptanceType'EnumOnline) = "online" instance Data.Aeson.Types.FromJSON.FromJSON CustomerAcceptanceType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "offline" -> CustomerAcceptanceType'EnumOffline | val GHC.Classes.== "online" -> CustomerAcceptanceType'EnumOnline | GHC.Base.otherwise -> CustomerAcceptanceType'Other val )