{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Operations.PostRefunds 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
postRefunds ::
forall m.
StripeAPI.Common.MonadHTTP m =>
GHC.Maybe.Maybe PostRefundsRequestBody ->
StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response PostRefundsResponse)
postRefunds :: Maybe PostRefundsRequestBody
-> StripeT m (Response PostRefundsResponse)
postRefunds Maybe PostRefundsRequestBody
body =
(Response ByteString -> Response PostRefundsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response PostRefundsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( \Response ByteString
response_0 ->
(ByteString -> PostRefundsResponse)
-> Response ByteString -> Response PostRefundsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( (String -> PostRefundsResponse)
-> (PostRefundsResponse -> PostRefundsResponse)
-> Either String PostRefundsResponse
-> PostRefundsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> PostRefundsResponse
PostRefundsResponseError PostRefundsResponse -> PostRefundsResponse
forall a. a -> a
GHC.Base.id
(Either String PostRefundsResponse -> PostRefundsResponse)
-> (ByteString -> Either String PostRefundsResponse)
-> ByteString
-> PostRefundsResponse
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) ->
Refund -> PostRefundsResponse
PostRefundsResponse200
(Refund -> PostRefundsResponse)
-> Either String Refund -> Either String PostRefundsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String Refund
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
Data.Either.Either
GHC.Base.String
Refund
)
| 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 -> PostRefundsResponse
PostRefundsResponseDefault
(Error -> PostRefundsResponse)
-> Either String Error -> Either String PostRefundsResponse
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 PostRefundsResponse
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 PostRefundsRequestBody
-> 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/refunds") [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty Maybe PostRefundsRequestBody
body RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)
data PostRefundsRequestBody = PostRefundsRequestBody
{
PostRefundsRequestBody -> Maybe Int
postRefundsRequestBodyAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
PostRefundsRequestBody -> Maybe Text
postRefundsRequestBodyCharge :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostRefundsRequestBody -> Maybe [Text]
postRefundsRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
PostRefundsRequestBody
-> Maybe PostRefundsRequestBodyMetadata'Variants
postRefundsRequestBodyMetadata :: (GHC.Maybe.Maybe PostRefundsRequestBodyMetadata'Variants),
PostRefundsRequestBody -> Maybe Text
postRefundsRequestBodyPaymentIntent :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostRefundsRequestBody -> Maybe PostRefundsRequestBodyReason'
postRefundsRequestBodyReason :: (GHC.Maybe.Maybe PostRefundsRequestBodyReason'),
PostRefundsRequestBody -> Maybe Bool
postRefundsRequestBodyRefundApplicationFee :: (GHC.Maybe.Maybe GHC.Types.Bool),
PostRefundsRequestBody -> Maybe Bool
postRefundsRequestBodyReverseTransfer :: (GHC.Maybe.Maybe GHC.Types.Bool)
}
deriving
( Int -> PostRefundsRequestBody -> ShowS
[PostRefundsRequestBody] -> ShowS
PostRefundsRequestBody -> String
(Int -> PostRefundsRequestBody -> ShowS)
-> (PostRefundsRequestBody -> String)
-> ([PostRefundsRequestBody] -> ShowS)
-> Show PostRefundsRequestBody
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostRefundsRequestBody] -> ShowS
$cshowList :: [PostRefundsRequestBody] -> ShowS
show :: PostRefundsRequestBody -> String
$cshow :: PostRefundsRequestBody -> String
showsPrec :: Int -> PostRefundsRequestBody -> ShowS
$cshowsPrec :: Int -> PostRefundsRequestBody -> ShowS
GHC.Show.Show,
PostRefundsRequestBody -> PostRefundsRequestBody -> Bool
(PostRefundsRequestBody -> PostRefundsRequestBody -> Bool)
-> (PostRefundsRequestBody -> PostRefundsRequestBody -> Bool)
-> Eq PostRefundsRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostRefundsRequestBody -> PostRefundsRequestBody -> Bool
$c/= :: PostRefundsRequestBody -> PostRefundsRequestBody -> Bool
== :: PostRefundsRequestBody -> PostRefundsRequestBody -> Bool
$c== :: PostRefundsRequestBody -> PostRefundsRequestBody -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON PostRefundsRequestBody where
toJSON :: PostRefundsRequestBody -> Value
toJSON PostRefundsRequestBody
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe Int
postRefundsRequestBodyAmount PostRefundsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"charge" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe Text
postRefundsRequestBodyCharge PostRefundsRequestBody
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..= PostRefundsRequestBody -> Maybe [Text]
postRefundsRequestBodyExpand PostRefundsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Maybe PostRefundsRequestBodyMetadata'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody
-> Maybe PostRefundsRequestBodyMetadata'Variants
postRefundsRequestBodyMetadata PostRefundsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"payment_intent" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe Text
postRefundsRequestBodyPaymentIntent PostRefundsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"reason" Text -> Maybe PostRefundsRequestBodyReason' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe PostRefundsRequestBodyReason'
postRefundsRequestBodyReason PostRefundsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"refund_application_fee" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe Bool
postRefundsRequestBodyRefundApplicationFee PostRefundsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"reverse_transfer" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe Bool
postRefundsRequestBodyReverseTransfer PostRefundsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: PostRefundsRequestBody -> Encoding
toEncoding PostRefundsRequestBody
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe Int
postRefundsRequestBodyAmount PostRefundsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"charge" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe Text
postRefundsRequestBodyCharge PostRefundsRequestBody
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..= PostRefundsRequestBody -> Maybe [Text]
postRefundsRequestBodyExpand PostRefundsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Maybe PostRefundsRequestBodyMetadata'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody
-> Maybe PostRefundsRequestBodyMetadata'Variants
postRefundsRequestBodyMetadata PostRefundsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"payment_intent" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe Text
postRefundsRequestBodyPaymentIntent PostRefundsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"reason" Text -> Maybe PostRefundsRequestBodyReason' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe PostRefundsRequestBodyReason'
postRefundsRequestBodyReason PostRefundsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"refund_application_fee" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe Bool
postRefundsRequestBodyRefundApplicationFee PostRefundsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"reverse_transfer" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostRefundsRequestBody -> Maybe Bool
postRefundsRequestBodyReverseTransfer PostRefundsRequestBody
obj))))))))
instance Data.Aeson.Types.FromJSON.FromJSON PostRefundsRequestBody where
parseJSON :: Value -> Parser PostRefundsRequestBody
parseJSON = String
-> (Object -> Parser PostRefundsRequestBody)
-> Value
-> Parser PostRefundsRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostRefundsRequestBody" (\Object
obj -> ((((((((Maybe Int
-> Maybe Text
-> Maybe [Text]
-> Maybe PostRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody)
-> Parser
(Maybe Int
-> Maybe Text
-> Maybe [Text]
-> Maybe PostRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Int
-> Maybe Text
-> Maybe [Text]
-> Maybe PostRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody
PostRefundsRequestBody Parser
(Maybe Int
-> Maybe Text
-> Maybe [Text]
-> Maybe PostRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody)
-> Parser (Maybe Int)
-> Parser
(Maybe Text
-> Maybe [Text]
-> Maybe PostRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"amount")) Parser
(Maybe Text
-> Maybe [Text]
-> Maybe PostRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody)
-> Parser (Maybe Text)
-> Parser
(Maybe [Text]
-> Maybe PostRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody)
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
"charge")) Parser
(Maybe [Text]
-> Maybe PostRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody)
-> Parser (Maybe [Text])
-> Parser
(Maybe PostRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody)
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")) Parser
(Maybe PostRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody)
-> Parser (Maybe PostRefundsRequestBodyMetadata'Variants)
-> Parser
(Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe PostRefundsRequestBodyMetadata'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"metadata")) Parser
(Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody)
-> Parser (Maybe Text)
-> Parser
(Maybe PostRefundsRequestBodyReason'
-> Maybe Bool -> Maybe Bool -> PostRefundsRequestBody)
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
"payment_intent")) Parser
(Maybe PostRefundsRequestBodyReason'
-> Maybe Bool -> Maybe Bool -> PostRefundsRequestBody)
-> Parser (Maybe PostRefundsRequestBodyReason')
-> Parser (Maybe Bool -> Maybe Bool -> PostRefundsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe PostRefundsRequestBodyReason')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"reason")) Parser (Maybe Bool -> Maybe Bool -> PostRefundsRequestBody)
-> Parser (Maybe Bool)
-> Parser (Maybe Bool -> PostRefundsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"refund_application_fee")) Parser (Maybe Bool -> PostRefundsRequestBody)
-> Parser (Maybe Bool) -> Parser PostRefundsRequestBody
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"reverse_transfer"))
mkPostRefundsRequestBody :: PostRefundsRequestBody
mkPostRefundsRequestBody :: PostRefundsRequestBody
mkPostRefundsRequestBody =
PostRefundsRequestBody :: Maybe Int
-> Maybe Text
-> Maybe [Text]
-> Maybe PostRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostRefundsRequestBody
PostRefundsRequestBody
{ postRefundsRequestBodyAmount :: Maybe Int
postRefundsRequestBodyAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
postRefundsRequestBodyCharge :: Maybe Text
postRefundsRequestBodyCharge = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postRefundsRequestBodyExpand :: Maybe [Text]
postRefundsRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
postRefundsRequestBodyMetadata :: Maybe PostRefundsRequestBodyMetadata'Variants
postRefundsRequestBodyMetadata = Maybe PostRefundsRequestBodyMetadata'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
postRefundsRequestBodyPaymentIntent :: Maybe Text
postRefundsRequestBodyPaymentIntent = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postRefundsRequestBodyReason :: Maybe PostRefundsRequestBodyReason'
postRefundsRequestBodyReason = Maybe PostRefundsRequestBodyReason'
forall a. Maybe a
GHC.Maybe.Nothing,
postRefundsRequestBodyRefundApplicationFee :: Maybe Bool
postRefundsRequestBodyRefundApplicationFee = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
postRefundsRequestBodyReverseTransfer :: Maybe Bool
postRefundsRequestBodyReverseTransfer = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
}
data PostRefundsRequestBodyMetadata'Variants
=
PostRefundsRequestBodyMetadata'EmptyString
| PostRefundsRequestBodyMetadata'Object Data.Aeson.Types.Internal.Object
deriving (Int -> PostRefundsRequestBodyMetadata'Variants -> ShowS
[PostRefundsRequestBodyMetadata'Variants] -> ShowS
PostRefundsRequestBodyMetadata'Variants -> String
(Int -> PostRefundsRequestBodyMetadata'Variants -> ShowS)
-> (PostRefundsRequestBodyMetadata'Variants -> String)
-> ([PostRefundsRequestBodyMetadata'Variants] -> ShowS)
-> Show PostRefundsRequestBodyMetadata'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostRefundsRequestBodyMetadata'Variants] -> ShowS
$cshowList :: [PostRefundsRequestBodyMetadata'Variants] -> ShowS
show :: PostRefundsRequestBodyMetadata'Variants -> String
$cshow :: PostRefundsRequestBodyMetadata'Variants -> String
showsPrec :: Int -> PostRefundsRequestBodyMetadata'Variants -> ShowS
$cshowsPrec :: Int -> PostRefundsRequestBodyMetadata'Variants -> ShowS
GHC.Show.Show, PostRefundsRequestBodyMetadata'Variants
-> PostRefundsRequestBodyMetadata'Variants -> Bool
(PostRefundsRequestBodyMetadata'Variants
-> PostRefundsRequestBodyMetadata'Variants -> Bool)
-> (PostRefundsRequestBodyMetadata'Variants
-> PostRefundsRequestBodyMetadata'Variants -> Bool)
-> Eq PostRefundsRequestBodyMetadata'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostRefundsRequestBodyMetadata'Variants
-> PostRefundsRequestBodyMetadata'Variants -> Bool
$c/= :: PostRefundsRequestBodyMetadata'Variants
-> PostRefundsRequestBodyMetadata'Variants -> Bool
== :: PostRefundsRequestBodyMetadata'Variants
-> PostRefundsRequestBodyMetadata'Variants -> Bool
$c== :: PostRefundsRequestBodyMetadata'Variants
-> PostRefundsRequestBodyMetadata'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON PostRefundsRequestBodyMetadata'Variants where
toJSON :: PostRefundsRequestBodyMetadata'Variants -> Value
toJSON (PostRefundsRequestBodyMetadata'Object Object
a) = Object -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Object
a
toJSON (PostRefundsRequestBodyMetadata'Variants
PostRefundsRequestBodyMetadata'EmptyString) = Value
""
instance Data.Aeson.Types.FromJSON.FromJSON PostRefundsRequestBodyMetadata'Variants where
parseJSON :: Value -> Parser PostRefundsRequestBodyMetadata'Variants
parseJSON Value
val =
if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"" -> PostRefundsRequestBodyMetadata'Variants
-> Parser PostRefundsRequestBodyMetadata'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostRefundsRequestBodyMetadata'Variants
PostRefundsRequestBodyMetadata'EmptyString
| Bool
GHC.Base.otherwise -> case (Object -> PostRefundsRequestBodyMetadata'Variants
PostRefundsRequestBodyMetadata'Object (Object -> PostRefundsRequestBodyMetadata'Variants)
-> Result Object -> Result PostRefundsRequestBodyMetadata'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Object
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result PostRefundsRequestBodyMetadata'Variants
-> Result PostRefundsRequestBodyMetadata'Variants
-> Result PostRefundsRequestBodyMetadata'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result PostRefundsRequestBodyMetadata'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched" of
Data.Aeson.Types.Internal.Success PostRefundsRequestBodyMetadata'Variants
a -> PostRefundsRequestBodyMetadata'Variants
-> Parser PostRefundsRequestBodyMetadata'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostRefundsRequestBodyMetadata'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String -> Parser PostRefundsRequestBodyMetadata'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a
data PostRefundsRequestBodyReason'
=
PostRefundsRequestBodyReason'Other Data.Aeson.Types.Internal.Value
|
PostRefundsRequestBodyReason'Typed Data.Text.Internal.Text
|
PostRefundsRequestBodyReason'EnumDuplicate
|
PostRefundsRequestBodyReason'EnumFraudulent
|
PostRefundsRequestBodyReason'EnumRequestedByCustomer
deriving (Int -> PostRefundsRequestBodyReason' -> ShowS
[PostRefundsRequestBodyReason'] -> ShowS
PostRefundsRequestBodyReason' -> String
(Int -> PostRefundsRequestBodyReason' -> ShowS)
-> (PostRefundsRequestBodyReason' -> String)
-> ([PostRefundsRequestBodyReason'] -> ShowS)
-> Show PostRefundsRequestBodyReason'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostRefundsRequestBodyReason'] -> ShowS
$cshowList :: [PostRefundsRequestBodyReason'] -> ShowS
show :: PostRefundsRequestBodyReason' -> String
$cshow :: PostRefundsRequestBodyReason' -> String
showsPrec :: Int -> PostRefundsRequestBodyReason' -> ShowS
$cshowsPrec :: Int -> PostRefundsRequestBodyReason' -> ShowS
GHC.Show.Show, PostRefundsRequestBodyReason'
-> PostRefundsRequestBodyReason' -> Bool
(PostRefundsRequestBodyReason'
-> PostRefundsRequestBodyReason' -> Bool)
-> (PostRefundsRequestBodyReason'
-> PostRefundsRequestBodyReason' -> Bool)
-> Eq PostRefundsRequestBodyReason'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostRefundsRequestBodyReason'
-> PostRefundsRequestBodyReason' -> Bool
$c/= :: PostRefundsRequestBodyReason'
-> PostRefundsRequestBodyReason' -> Bool
== :: PostRefundsRequestBodyReason'
-> PostRefundsRequestBodyReason' -> Bool
$c== :: PostRefundsRequestBodyReason'
-> PostRefundsRequestBodyReason' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON PostRefundsRequestBodyReason' where
toJSON :: PostRefundsRequestBodyReason' -> Value
toJSON (PostRefundsRequestBodyReason'Other Value
val) = Value
val
toJSON (PostRefundsRequestBodyReason'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (PostRefundsRequestBodyReason'
PostRefundsRequestBodyReason'EnumDuplicate) = Value
"duplicate"
toJSON (PostRefundsRequestBodyReason'
PostRefundsRequestBodyReason'EnumFraudulent) = Value
"fraudulent"
toJSON (PostRefundsRequestBodyReason'
PostRefundsRequestBodyReason'EnumRequestedByCustomer) = Value
"requested_by_customer"
instance Data.Aeson.Types.FromJSON.FromJSON PostRefundsRequestBodyReason' where
parseJSON :: Value -> Parser PostRefundsRequestBodyReason'
parseJSON Value
val =
PostRefundsRequestBodyReason'
-> Parser PostRefundsRequestBodyReason'
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
"duplicate" -> PostRefundsRequestBodyReason'
PostRefundsRequestBodyReason'EnumDuplicate
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"fraudulent" -> PostRefundsRequestBodyReason'
PostRefundsRequestBodyReason'EnumFraudulent
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"requested_by_customer" -> PostRefundsRequestBodyReason'
PostRefundsRequestBodyReason'EnumRequestedByCustomer
| Bool
GHC.Base.otherwise -> Value -> PostRefundsRequestBodyReason'
PostRefundsRequestBodyReason'Other Value
val
)
data PostRefundsResponse
=
PostRefundsResponseError GHC.Base.String
|
PostRefundsResponse200 Refund
|
PostRefundsResponseDefault Error
deriving (Int -> PostRefundsResponse -> ShowS
[PostRefundsResponse] -> ShowS
PostRefundsResponse -> String
(Int -> PostRefundsResponse -> ShowS)
-> (PostRefundsResponse -> String)
-> ([PostRefundsResponse] -> ShowS)
-> Show PostRefundsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostRefundsResponse] -> ShowS
$cshowList :: [PostRefundsResponse] -> ShowS
show :: PostRefundsResponse -> String
$cshow :: PostRefundsResponse -> String
showsPrec :: Int -> PostRefundsResponse -> ShowS
$cshowsPrec :: Int -> PostRefundsResponse -> ShowS
GHC.Show.Show, PostRefundsResponse -> PostRefundsResponse -> Bool
(PostRefundsResponse -> PostRefundsResponse -> Bool)
-> (PostRefundsResponse -> PostRefundsResponse -> Bool)
-> Eq PostRefundsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostRefundsResponse -> PostRefundsResponse -> Bool
$c/= :: PostRefundsResponse -> PostRefundsResponse -> Bool
== :: PostRefundsResponse -> PostRefundsResponse -> Bool
$c== :: PostRefundsResponse -> PostRefundsResponse -> Bool
GHC.Classes.Eq)