{-# LANGUAGE ExplicitForAll #-}
{-# 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 different functions to run the operation postPaymentIntentsIntentCancel
module StripeAPI.Operations.PostPaymentIntentsIntentCancel where

import qualified Control.Monad.Fail
import qualified Control.Monad.Trans.Reader
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.Either
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 Data.Vector
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified Network.HTTP.Client
import qualified Network.HTTP.Client as Network.HTTP.Client.Request
import qualified Network.HTTP.Client as Network.HTTP.Client.Types
import qualified Network.HTTP.Simple
import qualified Network.HTTP.Types
import qualified Network.HTTP.Types as Network.HTTP.Types.Status
import qualified Network.HTTP.Types as Network.HTTP.Types.URI
import qualified StripeAPI.Common
import StripeAPI.Types
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | > POST /v1/payment_intents/{intent}/cancel
--
-- \<p>A PaymentIntent object can be canceled when it is in one of these statuses: \<code>requires_payment_method\<\/code>, \<code>requires_capture\<\/code>, \<code>requires_confirmation\<\/code>, or \<code>requires_action\<\/code>. \<\/p>
--
-- \<p>Once canceled, no additional charges will be made by the PaymentIntent and any operations on the PaymentIntent will fail with an error. For PaymentIntents with \<code>status=’requires_capture’\<\/code>, the remaining \<code>amount_capturable\<\/code> will automatically be refunded.\<\/p>
postPaymentIntentsIntentCancel ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | intent | Constraints: Maximum length of 5000
  Data.Text.Internal.Text ->
  -- | The request body to send
  GHC.Maybe.Maybe PostPaymentIntentsIntentCancelRequestBody ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response PostPaymentIntentsIntentCancelResponse)
postPaymentIntentsIntentCancel :: Text
-> Maybe PostPaymentIntentsIntentCancelRequestBody
-> StripeT m (Response PostPaymentIntentsIntentCancelResponse)
postPaymentIntentsIntentCancel
  Text
intent
  Maybe PostPaymentIntentsIntentCancelRequestBody
body =
    (Response ByteString
 -> Response PostPaymentIntentsIntentCancelResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response PostPaymentIntentsIntentCancelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
      ( \Response ByteString
response_0 ->
          (ByteString -> PostPaymentIntentsIntentCancelResponse)
-> Response ByteString
-> Response PostPaymentIntentsIntentCancelResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
            ( (String -> PostPaymentIntentsIntentCancelResponse)
-> (PostPaymentIntentsIntentCancelResponse
    -> PostPaymentIntentsIntentCancelResponse)
-> Either String PostPaymentIntentsIntentCancelResponse
-> PostPaymentIntentsIntentCancelResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> PostPaymentIntentsIntentCancelResponse
PostPaymentIntentsIntentCancelResponseError PostPaymentIntentsIntentCancelResponse
-> PostPaymentIntentsIntentCancelResponse
forall a. a -> a
GHC.Base.id
                (Either String PostPaymentIntentsIntentCancelResponse
 -> PostPaymentIntentsIntentCancelResponse)
-> (ByteString
    -> Either String PostPaymentIntentsIntentCancelResponse)
-> ByteString
-> PostPaymentIntentsIntentCancelResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. ( \Response ByteString
response ByteString
body ->
                               if
                                   | (\Status
status_1 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_1 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Int
200) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                     PaymentIntent -> PostPaymentIntentsIntentCancelResponse
PostPaymentIntentsIntentCancelResponse200
                                       (PaymentIntent -> PostPaymentIntentsIntentCancelResponse)
-> Either String PaymentIntent
-> Either String PostPaymentIntentsIntentCancelResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String PaymentIntent
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                            Data.Either.Either
                                                              GHC.Base.String
                                                              PaymentIntent
                                                        )
                                   | Bool -> Status -> Bool
forall a b. a -> b -> a
GHC.Base.const Bool
GHC.Types.True (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                     Error -> PostPaymentIntentsIntentCancelResponse
PostPaymentIntentsIntentCancelResponseDefault
                                       (Error -> PostPaymentIntentsIntentCancelResponse)
-> Either String Error
-> Either String PostPaymentIntentsIntentCancelResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String Error
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                            Data.Either.Either
                                                              GHC.Base.String
                                                              Error
                                                        )
                                   | Bool
GHC.Base.otherwise -> String -> Either String PostPaymentIntentsIntentCancelResponse
forall a b. a -> Either a b
Data.Either.Left String
"Missing default response type"
                           )
                  Response ByteString
response_0
            )
            Response ByteString
response_0
      )
      (Text
-> Text
-> [QueryParameter]
-> Maybe PostPaymentIntentsIntentCancelRequestBody
-> RequestBodyEncoding
-> StripeT m (Response ByteString)
forall (m :: * -> *) body.
(MonadHTTP m, ToJSON body) =>
Text
-> Text
-> [QueryParameter]
-> Maybe body
-> RequestBodyEncoding
-> StripeT m (Response ByteString)
StripeAPI.Common.doBodyCallWithConfigurationM (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.pack String
"POST") (String -> Text
Data.Text.pack (String
"/v1/payment_intents/" String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ (ByteString -> String
Data.ByteString.Char8.unpack (Bool -> ByteString -> ByteString
Network.HTTP.Types.URI.urlEncode Bool
GHC.Types.True (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ (String -> ByteString
Data.ByteString.Char8.pack (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> String
forall a. StringifyModel a => a -> String
StripeAPI.Common.stringifyModel Text
intent)) String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ String
"/cancel"))) [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty Maybe PostPaymentIntentsIntentCancelRequestBody
body RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)

-- | Defines the object schema located at @paths.\/v1\/payment_intents\/{intent}\/cancel.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification.
data PostPaymentIntentsIntentCancelRequestBody = PostPaymentIntentsIntentCancelRequestBody
  { -- | cancellation_reason: Reason for canceling this PaymentIntent. Possible values are \`duplicate\`, \`fraudulent\`, \`requested_by_customer\`, or \`abandoned\`
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostPaymentIntentsIntentCancelRequestBody
-> Maybe
     PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
postPaymentIntentsIntentCancelRequestBodyCancellationReason :: (GHC.Maybe.Maybe PostPaymentIntentsIntentCancelRequestBodyCancellationReason'),
    -- | expand: Specifies which fields in the response should be expanded.
    PostPaymentIntentsIntentCancelRequestBody -> Maybe [Text]
postPaymentIntentsIntentCancelRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text]))
  }
  deriving
    ( Int
-> PostPaymentIntentsIntentCancelRequestBody -> String -> String
[PostPaymentIntentsIntentCancelRequestBody] -> String -> String
PostPaymentIntentsIntentCancelRequestBody -> String
(Int
 -> PostPaymentIntentsIntentCancelRequestBody -> String -> String)
-> (PostPaymentIntentsIntentCancelRequestBody -> String)
-> ([PostPaymentIntentsIntentCancelRequestBody]
    -> String -> String)
-> Show PostPaymentIntentsIntentCancelRequestBody
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostPaymentIntentsIntentCancelRequestBody] -> String -> String
$cshowList :: [PostPaymentIntentsIntentCancelRequestBody] -> String -> String
show :: PostPaymentIntentsIntentCancelRequestBody -> String
$cshow :: PostPaymentIntentsIntentCancelRequestBody -> String
showsPrec :: Int
-> PostPaymentIntentsIntentCancelRequestBody -> String -> String
$cshowsPrec :: Int
-> PostPaymentIntentsIntentCancelRequestBody -> String -> String
GHC.Show.Show,
      PostPaymentIntentsIntentCancelRequestBody
-> PostPaymentIntentsIntentCancelRequestBody -> Bool
(PostPaymentIntentsIntentCancelRequestBody
 -> PostPaymentIntentsIntentCancelRequestBody -> Bool)
-> (PostPaymentIntentsIntentCancelRequestBody
    -> PostPaymentIntentsIntentCancelRequestBody -> Bool)
-> Eq PostPaymentIntentsIntentCancelRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostPaymentIntentsIntentCancelRequestBody
-> PostPaymentIntentsIntentCancelRequestBody -> Bool
$c/= :: PostPaymentIntentsIntentCancelRequestBody
-> PostPaymentIntentsIntentCancelRequestBody -> Bool
== :: PostPaymentIntentsIntentCancelRequestBody
-> PostPaymentIntentsIntentCancelRequestBody -> Bool
$c== :: PostPaymentIntentsIntentCancelRequestBody
-> PostPaymentIntentsIntentCancelRequestBody -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostPaymentIntentsIntentCancelRequestBody where
  toJSON :: PostPaymentIntentsIntentCancelRequestBody -> Value
toJSON PostPaymentIntentsIntentCancelRequestBody
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"cancellation_reason" Text
-> Maybe
     PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPaymentIntentsIntentCancelRequestBody
-> Maybe
     PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
postPaymentIntentsIntentCancelRequestBodyCancellationReason PostPaymentIntentsIntentCancelRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"expand" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPaymentIntentsIntentCancelRequestBody -> Maybe [Text]
postPaymentIntentsIntentCancelRequestBodyExpand PostPaymentIntentsIntentCancelRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostPaymentIntentsIntentCancelRequestBody -> Encoding
toEncoding PostPaymentIntentsIntentCancelRequestBody
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"cancellation_reason" Text
-> Maybe
     PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPaymentIntentsIntentCancelRequestBody
-> Maybe
     PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
postPaymentIntentsIntentCancelRequestBodyCancellationReason PostPaymentIntentsIntentCancelRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"expand" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPaymentIntentsIntentCancelRequestBody -> Maybe [Text]
postPaymentIntentsIntentCancelRequestBodyExpand PostPaymentIntentsIntentCancelRequestBody
obj))

instance Data.Aeson.Types.FromJSON.FromJSON PostPaymentIntentsIntentCancelRequestBody where
  parseJSON :: Value -> Parser PostPaymentIntentsIntentCancelRequestBody
parseJSON = String
-> (Object -> Parser PostPaymentIntentsIntentCancelRequestBody)
-> Value
-> Parser PostPaymentIntentsIntentCancelRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostPaymentIntentsIntentCancelRequestBody" (\Object
obj -> ((Maybe PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
 -> Maybe [Text] -> PostPaymentIntentsIntentCancelRequestBody)
-> Parser
     (Maybe PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
      -> Maybe [Text] -> PostPaymentIntentsIntentCancelRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> Maybe [Text] -> PostPaymentIntentsIntentCancelRequestBody
PostPaymentIntentsIntentCancelRequestBody Parser
  (Maybe PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
   -> Maybe [Text] -> PostPaymentIntentsIntentCancelRequestBody)
-> Parser
     (Maybe
        PostPaymentIntentsIntentCancelRequestBodyCancellationReason')
-> Parser
     (Maybe [Text] -> PostPaymentIntentsIntentCancelRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe
        PostPaymentIntentsIntentCancelRequestBodyCancellationReason')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"cancellation_reason")) Parser (Maybe [Text] -> PostPaymentIntentsIntentCancelRequestBody)
-> Parser (Maybe [Text])
-> Parser PostPaymentIntentsIntentCancelRequestBody
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
"expand"))

-- | Create a new 'PostPaymentIntentsIntentCancelRequestBody' with all required fields.
mkPostPaymentIntentsIntentCancelRequestBody :: PostPaymentIntentsIntentCancelRequestBody
mkPostPaymentIntentsIntentCancelRequestBody :: PostPaymentIntentsIntentCancelRequestBody
mkPostPaymentIntentsIntentCancelRequestBody =
  PostPaymentIntentsIntentCancelRequestBody :: Maybe PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> Maybe [Text] -> PostPaymentIntentsIntentCancelRequestBody
PostPaymentIntentsIntentCancelRequestBody
    { postPaymentIntentsIntentCancelRequestBodyCancellationReason :: Maybe PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
postPaymentIntentsIntentCancelRequestBodyCancellationReason = Maybe PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
forall a. Maybe a
GHC.Maybe.Nothing,
      postPaymentIntentsIntentCancelRequestBodyExpand :: Maybe [Text]
postPaymentIntentsIntentCancelRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @paths.\/v1\/payment_intents\/{intent}\/cancel.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.cancellation_reason@ in the specification.
--
-- Reason for canceling this PaymentIntent. Possible values are \`duplicate\`, \`fraudulent\`, \`requested_by_customer\`, or \`abandoned\`
data PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostPaymentIntentsIntentCancelRequestBodyCancellationReason'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.
    PostPaymentIntentsIntentCancelRequestBodyCancellationReason'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"abandoned"@
    PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumAbandoned
  | -- | Represents the JSON value @"duplicate"@
    PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumDuplicate
  | -- | Represents the JSON value @"fraudulent"@
    PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumFraudulent
  | -- | Represents the JSON value @"requested_by_customer"@
    PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumRequestedByCustomer
  deriving (Int
-> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> String
-> String
[PostPaymentIntentsIntentCancelRequestBodyCancellationReason']
-> String -> String
PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> String
(Int
 -> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
 -> String
 -> String)
-> (PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
    -> String)
-> ([PostPaymentIntentsIntentCancelRequestBodyCancellationReason']
    -> String -> String)
-> Show
     PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostPaymentIntentsIntentCancelRequestBodyCancellationReason']
-> String -> String
$cshowList :: [PostPaymentIntentsIntentCancelRequestBodyCancellationReason']
-> String -> String
show :: PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> String
$cshow :: PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> String
showsPrec :: Int
-> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> String
-> String
$cshowsPrec :: Int
-> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> String
-> String
GHC.Show.Show, PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> Bool
(PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
 -> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
 -> Bool)
-> (PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
    -> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
    -> Bool)
-> Eq PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> Bool
$c/= :: PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> Bool
== :: PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> Bool
$c== :: PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostPaymentIntentsIntentCancelRequestBodyCancellationReason' where
  toJSON :: PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> Value
toJSON (PostPaymentIntentsIntentCancelRequestBodyCancellationReason'Other Value
val) = Value
val
  toJSON (PostPaymentIntentsIntentCancelRequestBodyCancellationReason'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumAbandoned) = Value
"abandoned"
  toJSON (PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumDuplicate) = Value
"duplicate"
  toJSON (PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumFraudulent) = Value
"fraudulent"
  toJSON (PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumRequestedByCustomer) = Value
"requested_by_customer"

instance Data.Aeson.Types.FromJSON.FromJSON PostPaymentIntentsIntentCancelRequestBodyCancellationReason' where
  parseJSON :: Value
-> Parser
     PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
parseJSON Value
val =
    PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
-> Parser
     PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
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" -> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumAbandoned
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"duplicate" -> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumDuplicate
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"fraudulent" -> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumFraudulent
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"requested_by_customer" -> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
PostPaymentIntentsIntentCancelRequestBodyCancellationReason'EnumRequestedByCustomer
            | Bool
GHC.Base.otherwise -> Value
-> PostPaymentIntentsIntentCancelRequestBodyCancellationReason'
PostPaymentIntentsIntentCancelRequestBodyCancellationReason'Other Value
val
      )

-- | Represents a response of the operation 'postPaymentIntentsIntentCancel'.
--
-- The response constructor is chosen by the status code of the response. If no case matches (no specific case for the response code, no range case, no default case), 'PostPaymentIntentsIntentCancelResponseError' is used.
data PostPaymentIntentsIntentCancelResponse
  = -- | Means either no matching case available or a parse error
    PostPaymentIntentsIntentCancelResponseError GHC.Base.String
  | -- | Successful response.
    PostPaymentIntentsIntentCancelResponse200 PaymentIntent
  | -- | Error response.
    PostPaymentIntentsIntentCancelResponseDefault Error
  deriving (Int -> PostPaymentIntentsIntentCancelResponse -> String -> String
[PostPaymentIntentsIntentCancelResponse] -> String -> String
PostPaymentIntentsIntentCancelResponse -> String
(Int -> PostPaymentIntentsIntentCancelResponse -> String -> String)
-> (PostPaymentIntentsIntentCancelResponse -> String)
-> ([PostPaymentIntentsIntentCancelResponse] -> String -> String)
-> Show PostPaymentIntentsIntentCancelResponse
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostPaymentIntentsIntentCancelResponse] -> String -> String
$cshowList :: [PostPaymentIntentsIntentCancelResponse] -> String -> String
show :: PostPaymentIntentsIntentCancelResponse -> String
$cshow :: PostPaymentIntentsIntentCancelResponse -> String
showsPrec :: Int -> PostPaymentIntentsIntentCancelResponse -> String -> String
$cshowsPrec :: Int -> PostPaymentIntentsIntentCancelResponse -> String -> String
GHC.Show.Show, PostPaymentIntentsIntentCancelResponse
-> PostPaymentIntentsIntentCancelResponse -> Bool
(PostPaymentIntentsIntentCancelResponse
 -> PostPaymentIntentsIntentCancelResponse -> Bool)
-> (PostPaymentIntentsIntentCancelResponse
    -> PostPaymentIntentsIntentCancelResponse -> Bool)
-> Eq PostPaymentIntentsIntentCancelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostPaymentIntentsIntentCancelResponse
-> PostPaymentIntentsIntentCancelResponse -> Bool
$c/= :: PostPaymentIntentsIntentCancelResponse
-> PostPaymentIntentsIntentCancelResponse -> Bool
== :: PostPaymentIntentsIntentCancelResponse
-> PostPaymentIntentsIntentCancelResponse -> Bool
$c== :: PostPaymentIntentsIntentCancelResponse
-> PostPaymentIntentsIntentCancelResponse -> Bool
GHC.Classes.Eq)