{-# 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 ChargeOutcome module StripeAPI.Types.ChargeOutcome 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.Rule import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.charge_outcome@ in the specification. data ChargeOutcome = ChargeOutcome { -- | network_status: Possible values are \`approved_by_network\`, \`declined_by_network\`, \`not_sent_to_network\`, and \`reversed_after_approval\`. The value \`reversed_after_approval\` indicates the payment was [blocked by Stripe](https:\/\/stripe.com\/docs\/declines\#blocked-payments) after bank authorization, and may temporarily appear as \"pending\" on a cardholder\'s statement. -- -- Constraints: -- -- * Maximum length of 5000 chargeOutcomeNetworkStatus :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | reason: An enumerated value providing a more detailed explanation of the outcome\'s \`type\`. Charges blocked by Radar\'s default block rule have the value \`highest_risk_level\`. Charges placed in review by Radar\'s default review rule have the value \`elevated_risk_level\`. Charges authorized, blocked, or placed in review by custom rules have the value \`rule\`. See [understanding declines](https:\/\/stripe.com\/docs\/declines) for more details. -- -- Constraints: -- -- * Maximum length of 5000 chargeOutcomeReason :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | risk_level: Stripe Radar\'s evaluation of the riskiness of the payment. Possible values for evaluated payments are \`normal\`, \`elevated\`, \`highest\`. For non-card payments, and card-based payments predating the public assignment of risk levels, this field will have the value \`not_assessed\`. In the event of an error in the evaluation, this field will have the value \`unknown\`. This field is only available with Radar. -- -- Constraints: -- -- * Maximum length of 5000 chargeOutcomeRiskLevel :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | risk_score: Stripe Radar\'s evaluation of the riskiness of the payment. Possible values for evaluated payments are between 0 and 100. For non-card payments, card-based payments predating the public assignment of risk scores, or in the event of an error during evaluation, this field will not be present. This field is only available with Radar for Fraud Teams. chargeOutcomeRiskScore :: (GHC.Maybe.Maybe GHC.Types.Int), -- | rule: The ID of the Radar rule that matched the payment, if applicable. chargeOutcomeRule :: (GHC.Maybe.Maybe ChargeOutcomeRule'Variants), -- | seller_message: A human-readable description of the outcome type and reason, designed for you (the recipient of the payment), not your customer. -- -- Constraints: -- -- * Maximum length of 5000 chargeOutcomeSellerMessage :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | type: Possible values are \`authorized\`, \`manual_review\`, \`issuer_declined\`, \`blocked\`, and \`invalid\`. See [understanding declines](https:\/\/stripe.com\/docs\/declines) and [Radar reviews](https:\/\/stripe.com\/docs\/radar\/reviews) for details. -- -- Constraints: -- -- * Maximum length of 5000 chargeOutcomeType :: Data.Text.Internal.Text } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON ChargeOutcome where toJSON obj = Data.Aeson.Types.Internal.object ("network_status" Data.Aeson.Types.ToJSON..= chargeOutcomeNetworkStatus obj : "reason" Data.Aeson.Types.ToJSON..= chargeOutcomeReason obj : "risk_level" Data.Aeson.Types.ToJSON..= chargeOutcomeRiskLevel obj : "risk_score" Data.Aeson.Types.ToJSON..= chargeOutcomeRiskScore obj : "rule" Data.Aeson.Types.ToJSON..= chargeOutcomeRule obj : "seller_message" Data.Aeson.Types.ToJSON..= chargeOutcomeSellerMessage obj : "type" Data.Aeson.Types.ToJSON..= chargeOutcomeType obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("network_status" Data.Aeson.Types.ToJSON..= chargeOutcomeNetworkStatus obj) GHC.Base.<> (("reason" Data.Aeson.Types.ToJSON..= chargeOutcomeReason obj) GHC.Base.<> (("risk_level" Data.Aeson.Types.ToJSON..= chargeOutcomeRiskLevel obj) GHC.Base.<> (("risk_score" Data.Aeson.Types.ToJSON..= chargeOutcomeRiskScore obj) GHC.Base.<> (("rule" Data.Aeson.Types.ToJSON..= chargeOutcomeRule obj) GHC.Base.<> (("seller_message" Data.Aeson.Types.ToJSON..= chargeOutcomeSellerMessage obj) GHC.Base.<> ("type" Data.Aeson.Types.ToJSON..= chargeOutcomeType obj))))))) instance Data.Aeson.Types.FromJSON.FromJSON ChargeOutcome where parseJSON = Data.Aeson.Types.FromJSON.withObject "ChargeOutcome" (\obj -> ((((((GHC.Base.pure ChargeOutcome GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "network_status")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "reason")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "risk_level")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "risk_score")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "rule")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "seller_message")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "type")) -- | Create a new 'ChargeOutcome' with all required fields. mkChargeOutcome :: -- | 'chargeOutcomeType' Data.Text.Internal.Text -> ChargeOutcome mkChargeOutcome chargeOutcomeType = ChargeOutcome { chargeOutcomeNetworkStatus = GHC.Maybe.Nothing, chargeOutcomeReason = GHC.Maybe.Nothing, chargeOutcomeRiskLevel = GHC.Maybe.Nothing, chargeOutcomeRiskScore = GHC.Maybe.Nothing, chargeOutcomeRule = GHC.Maybe.Nothing, chargeOutcomeSellerMessage = GHC.Maybe.Nothing, chargeOutcomeType = chargeOutcomeType } -- | Defines the oneOf schema located at @components.schemas.charge_outcome.properties.rule.anyOf@ in the specification. -- -- The ID of the Radar rule that matched the payment, if applicable. data ChargeOutcomeRule'Variants = ChargeOutcomeRule'Text Data.Text.Internal.Text | ChargeOutcomeRule'Rule Rule deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ChargeOutcomeRule'Variants where toJSON (ChargeOutcomeRule'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (ChargeOutcomeRule'Rule a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON ChargeOutcomeRule'Variants where parseJSON val = case (ChargeOutcomeRule'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((ChargeOutcomeRule'Rule Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched") of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a