{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Operations.PostChargesChargeRefunds 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
postChargesChargeRefunds ::
forall m.
StripeAPI.Common.MonadHTTP m =>
Data.Text.Internal.Text ->
GHC.Maybe.Maybe PostChargesChargeRefundsRequestBody ->
StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response PostChargesChargeRefundsResponse)
postChargesChargeRefunds :: Text
-> Maybe PostChargesChargeRefundsRequestBody
-> StripeT m (Response PostChargesChargeRefundsResponse)
postChargesChargeRefunds
Text
charge
Maybe PostChargesChargeRefundsRequestBody
body =
(Response ByteString -> Response PostChargesChargeRefundsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response PostChargesChargeRefundsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( \Response ByteString
response_0 ->
(ByteString -> PostChargesChargeRefundsResponse)
-> Response ByteString -> Response PostChargesChargeRefundsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( (String -> PostChargesChargeRefundsResponse)
-> (PostChargesChargeRefundsResponse
-> PostChargesChargeRefundsResponse)
-> Either String PostChargesChargeRefundsResponse
-> PostChargesChargeRefundsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> PostChargesChargeRefundsResponse
PostChargesChargeRefundsResponseError PostChargesChargeRefundsResponse
-> PostChargesChargeRefundsResponse
forall a. a -> a
GHC.Base.id
(Either String PostChargesChargeRefundsResponse
-> PostChargesChargeRefundsResponse)
-> (ByteString -> Either String PostChargesChargeRefundsResponse)
-> ByteString
-> PostChargesChargeRefundsResponse
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 -> PostChargesChargeRefundsResponse
PostChargesChargeRefundsResponse200
(Refund -> PostChargesChargeRefundsResponse)
-> Either String Refund
-> Either String PostChargesChargeRefundsResponse
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 -> PostChargesChargeRefundsResponse
PostChargesChargeRefundsResponseDefault
(Error -> PostChargesChargeRefundsResponse)
-> Either String Error
-> Either String PostChargesChargeRefundsResponse
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 PostChargesChargeRefundsResponse
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 PostChargesChargeRefundsRequestBody
-> 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/charges/" 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
charge)) String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ String
"/refunds"))) [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty Maybe PostChargesChargeRefundsRequestBody
body RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)
data PostChargesChargeRefundsRequestBody = PostChargesChargeRefundsRequestBody
{
PostChargesChargeRefundsRequestBody -> Maybe Int
postChargesChargeRefundsRequestBodyAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
PostChargesChargeRefundsRequestBody -> Maybe [Text]
postChargesChargeRefundsRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
PostChargesChargeRefundsRequestBody
-> Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
postChargesChargeRefundsRequestBodyMetadata :: (GHC.Maybe.Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants),
PostChargesChargeRefundsRequestBody -> Maybe Text
postChargesChargeRefundsRequestBodyPaymentIntent :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostChargesChargeRefundsRequestBody
-> Maybe PostChargesChargeRefundsRequestBodyReason'
postChargesChargeRefundsRequestBodyReason :: (GHC.Maybe.Maybe PostChargesChargeRefundsRequestBodyReason'),
PostChargesChargeRefundsRequestBody -> Maybe Bool
postChargesChargeRefundsRequestBodyRefundApplicationFee :: (GHC.Maybe.Maybe GHC.Types.Bool),
PostChargesChargeRefundsRequestBody -> Maybe Bool
postChargesChargeRefundsRequestBodyReverseTransfer :: (GHC.Maybe.Maybe GHC.Types.Bool)
}
deriving
( Int -> PostChargesChargeRefundsRequestBody -> String -> String
[PostChargesChargeRefundsRequestBody] -> String -> String
PostChargesChargeRefundsRequestBody -> String
(Int -> PostChargesChargeRefundsRequestBody -> String -> String)
-> (PostChargesChargeRefundsRequestBody -> String)
-> ([PostChargesChargeRefundsRequestBody] -> String -> String)
-> Show PostChargesChargeRefundsRequestBody
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostChargesChargeRefundsRequestBody] -> String -> String
$cshowList :: [PostChargesChargeRefundsRequestBody] -> String -> String
show :: PostChargesChargeRefundsRequestBody -> String
$cshow :: PostChargesChargeRefundsRequestBody -> String
showsPrec :: Int -> PostChargesChargeRefundsRequestBody -> String -> String
$cshowsPrec :: Int -> PostChargesChargeRefundsRequestBody -> String -> String
GHC.Show.Show,
PostChargesChargeRefundsRequestBody
-> PostChargesChargeRefundsRequestBody -> Bool
(PostChargesChargeRefundsRequestBody
-> PostChargesChargeRefundsRequestBody -> Bool)
-> (PostChargesChargeRefundsRequestBody
-> PostChargesChargeRefundsRequestBody -> Bool)
-> Eq PostChargesChargeRefundsRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesChargeRefundsRequestBody
-> PostChargesChargeRefundsRequestBody -> Bool
$c/= :: PostChargesChargeRefundsRequestBody
-> PostChargesChargeRefundsRequestBody -> Bool
== :: PostChargesChargeRefundsRequestBody
-> PostChargesChargeRefundsRequestBody -> Bool
$c== :: PostChargesChargeRefundsRequestBody
-> PostChargesChargeRefundsRequestBody -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON PostChargesChargeRefundsRequestBody where
toJSON :: PostChargesChargeRefundsRequestBody -> Value
toJSON PostChargesChargeRefundsRequestBody
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..= PostChargesChargeRefundsRequestBody -> Maybe Int
postChargesChargeRefundsRequestBodyAmount PostChargesChargeRefundsRequestBody
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..= PostChargesChargeRefundsRequestBody -> Maybe [Text]
postChargesChargeRefundsRequestBodyExpand PostChargesChargeRefundsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text
-> Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesChargeRefundsRequestBody
-> Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
postChargesChargeRefundsRequestBodyMetadata PostChargesChargeRefundsRequestBody
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..= PostChargesChargeRefundsRequestBody -> Maybe Text
postChargesChargeRefundsRequestBodyPaymentIntent PostChargesChargeRefundsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"reason" Text -> Maybe PostChargesChargeRefundsRequestBodyReason' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesChargeRefundsRequestBody
-> Maybe PostChargesChargeRefundsRequestBodyReason'
postChargesChargeRefundsRequestBodyReason PostChargesChargeRefundsRequestBody
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..= PostChargesChargeRefundsRequestBody -> Maybe Bool
postChargesChargeRefundsRequestBodyRefundApplicationFee PostChargesChargeRefundsRequestBody
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..= PostChargesChargeRefundsRequestBody -> Maybe Bool
postChargesChargeRefundsRequestBodyReverseTransfer PostChargesChargeRefundsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: PostChargesChargeRefundsRequestBody -> Encoding
toEncoding PostChargesChargeRefundsRequestBody
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..= PostChargesChargeRefundsRequestBody -> Maybe Int
postChargesChargeRefundsRequestBodyAmount PostChargesChargeRefundsRequestBody
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..= PostChargesChargeRefundsRequestBody -> Maybe [Text]
postChargesChargeRefundsRequestBodyExpand PostChargesChargeRefundsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text
-> Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesChargeRefundsRequestBody
-> Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
postChargesChargeRefundsRequestBodyMetadata PostChargesChargeRefundsRequestBody
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..= PostChargesChargeRefundsRequestBody -> Maybe Text
postChargesChargeRefundsRequestBodyPaymentIntent PostChargesChargeRefundsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"reason" Text -> Maybe PostChargesChargeRefundsRequestBodyReason' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesChargeRefundsRequestBody
-> Maybe PostChargesChargeRefundsRequestBodyReason'
postChargesChargeRefundsRequestBodyReason PostChargesChargeRefundsRequestBody
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..= PostChargesChargeRefundsRequestBody -> Maybe Bool
postChargesChargeRefundsRequestBodyRefundApplicationFee PostChargesChargeRefundsRequestBody
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..= PostChargesChargeRefundsRequestBody -> Maybe Bool
postChargesChargeRefundsRequestBodyReverseTransfer PostChargesChargeRefundsRequestBody
obj)))))))
instance Data.Aeson.Types.FromJSON.FromJSON PostChargesChargeRefundsRequestBody where
parseJSON :: Value -> Parser PostChargesChargeRefundsRequestBody
parseJSON = String
-> (Object -> Parser PostChargesChargeRefundsRequestBody)
-> Value
-> Parser PostChargesChargeRefundsRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostChargesChargeRefundsRequestBody" (\Object
obj -> (((((((Maybe Int
-> Maybe [Text]
-> Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostChargesChargeRefundsRequestBody)
-> Parser
(Maybe Int
-> Maybe [Text]
-> Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostChargesChargeRefundsRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Int
-> Maybe [Text]
-> Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostChargesChargeRefundsRequestBody
PostChargesChargeRefundsRequestBody Parser
(Maybe Int
-> Maybe [Text]
-> Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostChargesChargeRefundsRequestBody)
-> Parser (Maybe Int)
-> Parser
(Maybe [Text]
-> Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostChargesChargeRefundsRequestBody)
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 PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostChargesChargeRefundsRequestBody)
-> Parser (Maybe [Text])
-> Parser
(Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostChargesChargeRefundsRequestBody)
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 PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostChargesChargeRefundsRequestBody)
-> Parser
(Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants)
-> Parser
(Maybe Text
-> Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostChargesChargeRefundsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
(Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"metadata")) Parser
(Maybe Text
-> Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostChargesChargeRefundsRequestBody)
-> Parser (Maybe Text)
-> Parser
(Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool -> Maybe Bool -> PostChargesChargeRefundsRequestBody)
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 PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool -> Maybe Bool -> PostChargesChargeRefundsRequestBody)
-> Parser (Maybe PostChargesChargeRefundsRequestBodyReason')
-> Parser
(Maybe Bool -> Maybe Bool -> PostChargesChargeRefundsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe PostChargesChargeRefundsRequestBodyReason')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"reason")) Parser
(Maybe Bool -> Maybe Bool -> PostChargesChargeRefundsRequestBody)
-> Parser (Maybe Bool)
-> Parser (Maybe Bool -> PostChargesChargeRefundsRequestBody)
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 -> PostChargesChargeRefundsRequestBody)
-> Parser (Maybe Bool)
-> Parser PostChargesChargeRefundsRequestBody
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"))
mkPostChargesChargeRefundsRequestBody :: PostChargesChargeRefundsRequestBody
mkPostChargesChargeRefundsRequestBody :: PostChargesChargeRefundsRequestBody
mkPostChargesChargeRefundsRequestBody =
PostChargesChargeRefundsRequestBody :: Maybe Int
-> Maybe [Text]
-> Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe PostChargesChargeRefundsRequestBodyReason'
-> Maybe Bool
-> Maybe Bool
-> PostChargesChargeRefundsRequestBody
PostChargesChargeRefundsRequestBody
{ postChargesChargeRefundsRequestBodyAmount :: Maybe Int
postChargesChargeRefundsRequestBodyAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
postChargesChargeRefundsRequestBodyExpand :: Maybe [Text]
postChargesChargeRefundsRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
postChargesChargeRefundsRequestBodyMetadata :: Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
postChargesChargeRefundsRequestBodyMetadata = Maybe PostChargesChargeRefundsRequestBodyMetadata'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
postChargesChargeRefundsRequestBodyPaymentIntent :: Maybe Text
postChargesChargeRefundsRequestBodyPaymentIntent = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postChargesChargeRefundsRequestBodyReason :: Maybe PostChargesChargeRefundsRequestBodyReason'
postChargesChargeRefundsRequestBodyReason = Maybe PostChargesChargeRefundsRequestBodyReason'
forall a. Maybe a
GHC.Maybe.Nothing,
postChargesChargeRefundsRequestBodyRefundApplicationFee :: Maybe Bool
postChargesChargeRefundsRequestBodyRefundApplicationFee = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
postChargesChargeRefundsRequestBodyReverseTransfer :: Maybe Bool
postChargesChargeRefundsRequestBodyReverseTransfer = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
}
data PostChargesChargeRefundsRequestBodyMetadata'Variants
=
PostChargesChargeRefundsRequestBodyMetadata'EmptyString
| PostChargesChargeRefundsRequestBodyMetadata'Object Data.Aeson.Types.Internal.Object
deriving (Int
-> PostChargesChargeRefundsRequestBodyMetadata'Variants
-> String
-> String
[PostChargesChargeRefundsRequestBodyMetadata'Variants]
-> String -> String
PostChargesChargeRefundsRequestBodyMetadata'Variants -> String
(Int
-> PostChargesChargeRefundsRequestBodyMetadata'Variants
-> String
-> String)
-> (PostChargesChargeRefundsRequestBodyMetadata'Variants -> String)
-> ([PostChargesChargeRefundsRequestBodyMetadata'Variants]
-> String -> String)
-> Show PostChargesChargeRefundsRequestBodyMetadata'Variants
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostChargesChargeRefundsRequestBodyMetadata'Variants]
-> String -> String
$cshowList :: [PostChargesChargeRefundsRequestBodyMetadata'Variants]
-> String -> String
show :: PostChargesChargeRefundsRequestBodyMetadata'Variants -> String
$cshow :: PostChargesChargeRefundsRequestBodyMetadata'Variants -> String
showsPrec :: Int
-> PostChargesChargeRefundsRequestBodyMetadata'Variants
-> String
-> String
$cshowsPrec :: Int
-> PostChargesChargeRefundsRequestBodyMetadata'Variants
-> String
-> String
GHC.Show.Show, PostChargesChargeRefundsRequestBodyMetadata'Variants
-> PostChargesChargeRefundsRequestBodyMetadata'Variants -> Bool
(PostChargesChargeRefundsRequestBodyMetadata'Variants
-> PostChargesChargeRefundsRequestBodyMetadata'Variants -> Bool)
-> (PostChargesChargeRefundsRequestBodyMetadata'Variants
-> PostChargesChargeRefundsRequestBodyMetadata'Variants -> Bool)
-> Eq PostChargesChargeRefundsRequestBodyMetadata'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesChargeRefundsRequestBodyMetadata'Variants
-> PostChargesChargeRefundsRequestBodyMetadata'Variants -> Bool
$c/= :: PostChargesChargeRefundsRequestBodyMetadata'Variants
-> PostChargesChargeRefundsRequestBodyMetadata'Variants -> Bool
== :: PostChargesChargeRefundsRequestBodyMetadata'Variants
-> PostChargesChargeRefundsRequestBodyMetadata'Variants -> Bool
$c== :: PostChargesChargeRefundsRequestBodyMetadata'Variants
-> PostChargesChargeRefundsRequestBodyMetadata'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON PostChargesChargeRefundsRequestBodyMetadata'Variants where
toJSON :: PostChargesChargeRefundsRequestBodyMetadata'Variants -> Value
toJSON (PostChargesChargeRefundsRequestBodyMetadata'Object Object
a) = Object -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Object
a
toJSON (PostChargesChargeRefundsRequestBodyMetadata'Variants
PostChargesChargeRefundsRequestBodyMetadata'EmptyString) = Value
""
instance Data.Aeson.Types.FromJSON.FromJSON PostChargesChargeRefundsRequestBodyMetadata'Variants where
parseJSON :: Value
-> Parser PostChargesChargeRefundsRequestBodyMetadata'Variants
parseJSON Value
val =
if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"" -> PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Parser PostChargesChargeRefundsRequestBodyMetadata'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostChargesChargeRefundsRequestBodyMetadata'Variants
PostChargesChargeRefundsRequestBodyMetadata'EmptyString
| Bool
GHC.Base.otherwise -> case (Object -> PostChargesChargeRefundsRequestBodyMetadata'Variants
PostChargesChargeRefundsRequestBodyMetadata'Object (Object -> PostChargesChargeRefundsRequestBodyMetadata'Variants)
-> Result Object
-> Result PostChargesChargeRefundsRequestBodyMetadata'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 PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Result PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Result PostChargesChargeRefundsRequestBodyMetadata'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String
-> Result PostChargesChargeRefundsRequestBodyMetadata'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched" of
Data.Aeson.Types.Internal.Success PostChargesChargeRefundsRequestBodyMetadata'Variants
a -> PostChargesChargeRefundsRequestBodyMetadata'Variants
-> Parser PostChargesChargeRefundsRequestBodyMetadata'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostChargesChargeRefundsRequestBodyMetadata'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String
-> Parser PostChargesChargeRefundsRequestBodyMetadata'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a
data PostChargesChargeRefundsRequestBodyReason'
=
PostChargesChargeRefundsRequestBodyReason'Other Data.Aeson.Types.Internal.Value
|
PostChargesChargeRefundsRequestBodyReason'Typed Data.Text.Internal.Text
|
PostChargesChargeRefundsRequestBodyReason'EnumDuplicate
|
PostChargesChargeRefundsRequestBodyReason'EnumFraudulent
|
PostChargesChargeRefundsRequestBodyReason'EnumRequestedByCustomer
deriving (Int
-> PostChargesChargeRefundsRequestBodyReason' -> String -> String
[PostChargesChargeRefundsRequestBodyReason'] -> String -> String
PostChargesChargeRefundsRequestBodyReason' -> String
(Int
-> PostChargesChargeRefundsRequestBodyReason' -> String -> String)
-> (PostChargesChargeRefundsRequestBodyReason' -> String)
-> ([PostChargesChargeRefundsRequestBodyReason']
-> String -> String)
-> Show PostChargesChargeRefundsRequestBodyReason'
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostChargesChargeRefundsRequestBodyReason'] -> String -> String
$cshowList :: [PostChargesChargeRefundsRequestBodyReason'] -> String -> String
show :: PostChargesChargeRefundsRequestBodyReason' -> String
$cshow :: PostChargesChargeRefundsRequestBodyReason' -> String
showsPrec :: Int
-> PostChargesChargeRefundsRequestBodyReason' -> String -> String
$cshowsPrec :: Int
-> PostChargesChargeRefundsRequestBodyReason' -> String -> String
GHC.Show.Show, PostChargesChargeRefundsRequestBodyReason'
-> PostChargesChargeRefundsRequestBodyReason' -> Bool
(PostChargesChargeRefundsRequestBodyReason'
-> PostChargesChargeRefundsRequestBodyReason' -> Bool)
-> (PostChargesChargeRefundsRequestBodyReason'
-> PostChargesChargeRefundsRequestBodyReason' -> Bool)
-> Eq PostChargesChargeRefundsRequestBodyReason'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesChargeRefundsRequestBodyReason'
-> PostChargesChargeRefundsRequestBodyReason' -> Bool
$c/= :: PostChargesChargeRefundsRequestBodyReason'
-> PostChargesChargeRefundsRequestBodyReason' -> Bool
== :: PostChargesChargeRefundsRequestBodyReason'
-> PostChargesChargeRefundsRequestBodyReason' -> Bool
$c== :: PostChargesChargeRefundsRequestBodyReason'
-> PostChargesChargeRefundsRequestBodyReason' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON PostChargesChargeRefundsRequestBodyReason' where
toJSON :: PostChargesChargeRefundsRequestBodyReason' -> Value
toJSON (PostChargesChargeRefundsRequestBodyReason'Other Value
val) = Value
val
toJSON (PostChargesChargeRefundsRequestBodyReason'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (PostChargesChargeRefundsRequestBodyReason'
PostChargesChargeRefundsRequestBodyReason'EnumDuplicate) = Value
"duplicate"
toJSON (PostChargesChargeRefundsRequestBodyReason'
PostChargesChargeRefundsRequestBodyReason'EnumFraudulent) = Value
"fraudulent"
toJSON (PostChargesChargeRefundsRequestBodyReason'
PostChargesChargeRefundsRequestBodyReason'EnumRequestedByCustomer) = Value
"requested_by_customer"
instance Data.Aeson.Types.FromJSON.FromJSON PostChargesChargeRefundsRequestBodyReason' where
parseJSON :: Value -> Parser PostChargesChargeRefundsRequestBodyReason'
parseJSON Value
val =
PostChargesChargeRefundsRequestBodyReason'
-> Parser PostChargesChargeRefundsRequestBodyReason'
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" -> PostChargesChargeRefundsRequestBodyReason'
PostChargesChargeRefundsRequestBodyReason'EnumDuplicate
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"fraudulent" -> PostChargesChargeRefundsRequestBodyReason'
PostChargesChargeRefundsRequestBodyReason'EnumFraudulent
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"requested_by_customer" -> PostChargesChargeRefundsRequestBodyReason'
PostChargesChargeRefundsRequestBodyReason'EnumRequestedByCustomer
| Bool
GHC.Base.otherwise -> Value -> PostChargesChargeRefundsRequestBodyReason'
PostChargesChargeRefundsRequestBodyReason'Other Value
val
)
data PostChargesChargeRefundsResponse
=
PostChargesChargeRefundsResponseError GHC.Base.String
|
PostChargesChargeRefundsResponse200 Refund
|
PostChargesChargeRefundsResponseDefault Error
deriving (Int -> PostChargesChargeRefundsResponse -> String -> String
[PostChargesChargeRefundsResponse] -> String -> String
PostChargesChargeRefundsResponse -> String
(Int -> PostChargesChargeRefundsResponse -> String -> String)
-> (PostChargesChargeRefundsResponse -> String)
-> ([PostChargesChargeRefundsResponse] -> String -> String)
-> Show PostChargesChargeRefundsResponse
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostChargesChargeRefundsResponse] -> String -> String
$cshowList :: [PostChargesChargeRefundsResponse] -> String -> String
show :: PostChargesChargeRefundsResponse -> String
$cshow :: PostChargesChargeRefundsResponse -> String
showsPrec :: Int -> PostChargesChargeRefundsResponse -> String -> String
$cshowsPrec :: Int -> PostChargesChargeRefundsResponse -> String -> String
GHC.Show.Show, PostChargesChargeRefundsResponse
-> PostChargesChargeRefundsResponse -> Bool
(PostChargesChargeRefundsResponse
-> PostChargesChargeRefundsResponse -> Bool)
-> (PostChargesChargeRefundsResponse
-> PostChargesChargeRefundsResponse -> Bool)
-> Eq PostChargesChargeRefundsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesChargeRefundsResponse
-> PostChargesChargeRefundsResponse -> Bool
$c/= :: PostChargesChargeRefundsResponse
-> PostChargesChargeRefundsResponse -> Bool
== :: PostChargesChargeRefundsResponse
-> PostChargesChargeRefundsResponse -> Bool
$c== :: PostChargesChargeRefundsResponse
-> PostChargesChargeRefundsResponse -> Bool
GHC.Classes.Eq)