{-# 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 SourceRedirectFlow module StripeAPI.Types.SourceRedirectFlow 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.Foldable import qualified Data.Functor import qualified Data.Maybe 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 -- | Defines the object schema located at @components.schemas.source_redirect_flow@ in the specification. data SourceRedirectFlow = SourceRedirectFlow { -- | failure_reason: The failure reason for the redirect, either \`user_abort\` (the customer aborted or dropped out of the redirect flow), \`declined\` (the authentication failed or the transaction was declined), or \`processing_error\` (the redirect failed due to a technical error). Present only if the redirect status is \`failed\`. -- -- Constraints: -- -- * Maximum length of 5000 sourceRedirectFlowFailureReason :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable Data.Text.Internal.Text)), -- | return_url: The URL you provide to redirect the customer to after they authenticated their payment. -- -- Constraints: -- -- * Maximum length of 5000 sourceRedirectFlowReturnUrl :: Data.Text.Internal.Text, -- | status: The status of the redirect, either \`pending\` (ready to be used by your customer to authenticate the transaction), \`succeeded\` (succesful authentication, cannot be reused) or \`not_required\` (redirect should not be used) or \`failed\` (failed authentication, cannot be reused). -- -- Constraints: -- -- * Maximum length of 5000 sourceRedirectFlowStatus :: Data.Text.Internal.Text, -- | url: The URL provided to you to redirect a customer to as part of a \`redirect\` authentication flow. -- -- Constraints: -- -- * Maximum length of 2048 sourceRedirectFlowUrl :: Data.Text.Internal.Text } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON SourceRedirectFlow where toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("failure_reason" Data.Aeson.Types.ToJSON..=)) (sourceRedirectFlowFailureReason obj) : ["return_url" Data.Aeson.Types.ToJSON..= sourceRedirectFlowReturnUrl obj] : ["status" Data.Aeson.Types.ToJSON..= sourceRedirectFlowStatus obj] : ["url" Data.Aeson.Types.ToJSON..= sourceRedirectFlowUrl obj] : GHC.Base.mempty)) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("failure_reason" Data.Aeson.Types.ToJSON..=)) (sourceRedirectFlowFailureReason obj) : ["return_url" Data.Aeson.Types.ToJSON..= sourceRedirectFlowReturnUrl obj] : ["status" Data.Aeson.Types.ToJSON..= sourceRedirectFlowStatus obj] : ["url" Data.Aeson.Types.ToJSON..= sourceRedirectFlowUrl obj] : GHC.Base.mempty))) instance Data.Aeson.Types.FromJSON.FromJSON SourceRedirectFlow where parseJSON = Data.Aeson.Types.FromJSON.withObject "SourceRedirectFlow" (\obj -> (((GHC.Base.pure SourceRedirectFlow GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "failure_reason")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "return_url")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "status")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "url")) -- | Create a new 'SourceRedirectFlow' with all required fields. mkSourceRedirectFlow :: -- | 'sourceRedirectFlowReturnUrl' Data.Text.Internal.Text -> -- | 'sourceRedirectFlowStatus' Data.Text.Internal.Text -> -- | 'sourceRedirectFlowUrl' Data.Text.Internal.Text -> SourceRedirectFlow mkSourceRedirectFlow sourceRedirectFlowReturnUrl sourceRedirectFlowStatus sourceRedirectFlowUrl = SourceRedirectFlow { sourceRedirectFlowFailureReason = GHC.Maybe.Nothing, sourceRedirectFlowReturnUrl = sourceRedirectFlowReturnUrl, sourceRedirectFlowStatus = sourceRedirectFlowStatus, sourceRedirectFlowUrl = sourceRedirectFlowUrl }