{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Operations.PostCreditNotes 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
postCreditNotes ::
forall m.
StripeAPI.Common.MonadHTTP m =>
PostCreditNotesRequestBody ->
StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response PostCreditNotesResponse)
postCreditNotes :: PostCreditNotesRequestBody
-> ClientT m (Response PostCreditNotesResponse)
postCreditNotes PostCreditNotesRequestBody
body =
(Response ByteString -> Response PostCreditNotesResponse)
-> ClientT m (Response ByteString)
-> ClientT m (Response PostCreditNotesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( \Response ByteString
response_0 ->
(ByteString -> PostCreditNotesResponse)
-> Response ByteString -> Response PostCreditNotesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( (String -> PostCreditNotesResponse)
-> (PostCreditNotesResponse -> PostCreditNotesResponse)
-> Either String PostCreditNotesResponse
-> PostCreditNotesResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> PostCreditNotesResponse
PostCreditNotesResponseError PostCreditNotesResponse -> PostCreditNotesResponse
forall a. a -> a
GHC.Base.id
(Either String PostCreditNotesResponse -> PostCreditNotesResponse)
-> (ByteString -> Either String PostCreditNotesResponse)
-> ByteString
-> PostCreditNotesResponse
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) ->
CreditNote -> PostCreditNotesResponse
PostCreditNotesResponse200
(CreditNote -> PostCreditNotesResponse)
-> Either String CreditNote
-> Either String PostCreditNotesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String CreditNote
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
Data.Either.Either
GHC.Base.String
CreditNote
)
| 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 -> PostCreditNotesResponse
PostCreditNotesResponseDefault
(Error -> PostCreditNotesResponse)
-> Either String Error -> Either String PostCreditNotesResponse
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 PostCreditNotesResponse
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 PostCreditNotesRequestBody
-> RequestBodyEncoding
-> ClientT m (Response ByteString)
forall (m :: * -> *) body.
(MonadHTTP m, ToJSON body) =>
Text
-> Text
-> [QueryParameter]
-> Maybe body
-> RequestBodyEncoding
-> ClientT 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/credit_notes") [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty (PostCreditNotesRequestBody -> Maybe PostCreditNotesRequestBody
forall a. a -> Maybe a
GHC.Maybe.Just PostCreditNotesRequestBody
body) RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)
data PostCreditNotesRequestBody = PostCreditNotesRequestBody
{
PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyCreditAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
PostCreditNotesRequestBody -> Maybe [Text]
postCreditNotesRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
PostCreditNotesRequestBody -> Text
postCreditNotesRequestBodyInvoice :: Data.Text.Internal.Text,
PostCreditNotesRequestBody
-> Maybe [PostCreditNotesRequestBodyLines']
postCreditNotesRequestBodyLines :: (GHC.Maybe.Maybe ([PostCreditNotesRequestBodyLines'])),
PostCreditNotesRequestBody -> Maybe Text
postCreditNotesRequestBodyMemo :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostCreditNotesRequestBody -> Maybe Object
postCreditNotesRequestBodyMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyOutOfBandAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
PostCreditNotesRequestBody
-> Maybe PostCreditNotesRequestBodyReason'
postCreditNotesRequestBodyReason :: (GHC.Maybe.Maybe PostCreditNotesRequestBodyReason'),
PostCreditNotesRequestBody -> Maybe Text
postCreditNotesRequestBodyRefund :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyRefundAmount :: (GHC.Maybe.Maybe GHC.Types.Int)
}
deriving
( Int -> PostCreditNotesRequestBody -> ShowS
[PostCreditNotesRequestBody] -> ShowS
PostCreditNotesRequestBody -> String
(Int -> PostCreditNotesRequestBody -> ShowS)
-> (PostCreditNotesRequestBody -> String)
-> ([PostCreditNotesRequestBody] -> ShowS)
-> Show PostCreditNotesRequestBody
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostCreditNotesRequestBody] -> ShowS
$cshowList :: [PostCreditNotesRequestBody] -> ShowS
show :: PostCreditNotesRequestBody -> String
$cshow :: PostCreditNotesRequestBody -> String
showsPrec :: Int -> PostCreditNotesRequestBody -> ShowS
$cshowsPrec :: Int -> PostCreditNotesRequestBody -> ShowS
GHC.Show.Show,
PostCreditNotesRequestBody -> PostCreditNotesRequestBody -> Bool
(PostCreditNotesRequestBody -> PostCreditNotesRequestBody -> Bool)
-> (PostCreditNotesRequestBody
-> PostCreditNotesRequestBody -> Bool)
-> Eq PostCreditNotesRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostCreditNotesRequestBody -> PostCreditNotesRequestBody -> Bool
$c/= :: PostCreditNotesRequestBody -> PostCreditNotesRequestBody -> Bool
== :: PostCreditNotesRequestBody -> PostCreditNotesRequestBody -> Bool
$c== :: PostCreditNotesRequestBody -> PostCreditNotesRequestBody -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON PostCreditNotesRequestBody where
toJSON :: PostCreditNotesRequestBody -> Value
toJSON PostCreditNotesRequestBody
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..= PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyAmount PostCreditNotesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"credit_amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyCreditAmount PostCreditNotesRequestBody
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..= PostCreditNotesRequestBody -> Maybe [Text]
postCreditNotesRequestBodyExpand PostCreditNotesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"invoice" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Text
postCreditNotesRequestBodyInvoice PostCreditNotesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"lines" Text -> Maybe [PostCreditNotesRequestBodyLines'] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody
-> Maybe [PostCreditNotesRequestBodyLines']
postCreditNotesRequestBodyLines PostCreditNotesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"memo" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Text
postCreditNotesRequestBodyMemo PostCreditNotesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Object
postCreditNotesRequestBodyMetadata PostCreditNotesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"out_of_band_amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyOutOfBandAmount PostCreditNotesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"reason" Text -> Maybe PostCreditNotesRequestBodyReason' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody
-> Maybe PostCreditNotesRequestBodyReason'
postCreditNotesRequestBodyReason PostCreditNotesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"refund" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Text
postCreditNotesRequestBodyRefund PostCreditNotesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"refund_amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyRefundAmount PostCreditNotesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: PostCreditNotesRequestBody -> Encoding
toEncoding PostCreditNotesRequestBody
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..= PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyAmount PostCreditNotesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"credit_amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyCreditAmount PostCreditNotesRequestBody
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..= PostCreditNotesRequestBody -> Maybe [Text]
postCreditNotesRequestBodyExpand PostCreditNotesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"invoice" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Text
postCreditNotesRequestBodyInvoice PostCreditNotesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"lines" Text -> Maybe [PostCreditNotesRequestBodyLines'] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody
-> Maybe [PostCreditNotesRequestBodyLines']
postCreditNotesRequestBodyLines PostCreditNotesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"memo" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Text
postCreditNotesRequestBodyMemo PostCreditNotesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Object
postCreditNotesRequestBodyMetadata PostCreditNotesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"out_of_band_amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyOutOfBandAmount PostCreditNotesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"reason" Text -> Maybe PostCreditNotesRequestBodyReason' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody
-> Maybe PostCreditNotesRequestBodyReason'
postCreditNotesRequestBodyReason PostCreditNotesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"refund" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Text
postCreditNotesRequestBodyRefund PostCreditNotesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"refund_amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBody -> Maybe Int
postCreditNotesRequestBodyRefundAmount PostCreditNotesRequestBody
obj)))))))))))
instance Data.Aeson.Types.FromJSON.FromJSON PostCreditNotesRequestBody where
parseJSON :: Value -> Parser PostCreditNotesRequestBody
parseJSON = String
-> (Object -> Parser PostCreditNotesRequestBody)
-> Value
-> Parser PostCreditNotesRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostCreditNotesRequestBody" (\Object
obj -> (((((((((((Maybe Int
-> Maybe Int
-> Maybe [Text]
-> Text
-> Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
-> Parser
(Maybe Int
-> Maybe Int
-> Maybe [Text]
-> Text
-> Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Int
-> Maybe Int
-> Maybe [Text]
-> Text
-> Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody
PostCreditNotesRequestBody Parser
(Maybe Int
-> Maybe Int
-> Maybe [Text]
-> Text
-> Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
-> Parser (Maybe Int)
-> Parser
(Maybe Int
-> Maybe [Text]
-> Text
-> Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
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 Int
-> Maybe [Text]
-> Text
-> Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
-> Parser (Maybe Int)
-> Parser
(Maybe [Text]
-> Text
-> Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
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
"credit_amount")) Parser
(Maybe [Text]
-> Text
-> Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
-> Parser (Maybe [Text])
-> Parser
(Text
-> Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
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
(Text
-> Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
-> Parser Text
-> Parser
(Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"invoice")) Parser
(Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
-> Parser (Maybe [PostCreditNotesRequestBodyLines'])
-> Parser
(Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [PostCreditNotesRequestBodyLines'])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"lines")) Parser
(Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
-> Parser (Maybe Text)
-> Parser
(Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
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
"memo")) Parser
(Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
-> Parser (Maybe Object)
-> Parser
(Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Object)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"metadata")) Parser
(Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody)
-> Parser (Maybe Int)
-> Parser
(Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text -> Maybe Int -> PostCreditNotesRequestBody)
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
"out_of_band_amount")) Parser
(Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text -> Maybe Int -> PostCreditNotesRequestBody)
-> Parser (Maybe PostCreditNotesRequestBodyReason')
-> Parser (Maybe Text -> Maybe Int -> PostCreditNotesRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe PostCreditNotesRequestBodyReason')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"reason")) Parser (Maybe Text -> Maybe Int -> PostCreditNotesRequestBody)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> PostCreditNotesRequestBody)
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
"refund")) Parser (Maybe Int -> PostCreditNotesRequestBody)
-> Parser (Maybe Int) -> Parser PostCreditNotesRequestBody
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
"refund_amount"))
mkPostCreditNotesRequestBody ::
Data.Text.Internal.Text ->
PostCreditNotesRequestBody
mkPostCreditNotesRequestBody :: Text -> PostCreditNotesRequestBody
mkPostCreditNotesRequestBody Text
postCreditNotesRequestBodyInvoice =
PostCreditNotesRequestBody :: Maybe Int
-> Maybe Int
-> Maybe [Text]
-> Text
-> Maybe [PostCreditNotesRequestBodyLines']
-> Maybe Text
-> Maybe Object
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyReason'
-> Maybe Text
-> Maybe Int
-> PostCreditNotesRequestBody
PostCreditNotesRequestBody
{ postCreditNotesRequestBodyAmount :: Maybe Int
postCreditNotesRequestBodyAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyCreditAmount :: Maybe Int
postCreditNotesRequestBodyCreditAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyExpand :: Maybe [Text]
postCreditNotesRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyInvoice :: Text
postCreditNotesRequestBodyInvoice = Text
postCreditNotesRequestBodyInvoice,
postCreditNotesRequestBodyLines :: Maybe [PostCreditNotesRequestBodyLines']
postCreditNotesRequestBodyLines = Maybe [PostCreditNotesRequestBodyLines']
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyMemo :: Maybe Text
postCreditNotesRequestBodyMemo = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyMetadata :: Maybe Object
postCreditNotesRequestBodyMetadata = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyOutOfBandAmount :: Maybe Int
postCreditNotesRequestBodyOutOfBandAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyReason :: Maybe PostCreditNotesRequestBodyReason'
postCreditNotesRequestBodyReason = Maybe PostCreditNotesRequestBodyReason'
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyRefund :: Maybe Text
postCreditNotesRequestBodyRefund = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyRefundAmount :: Maybe Int
postCreditNotesRequestBodyRefundAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
}
data PostCreditNotesRequestBodyLines' = PostCreditNotesRequestBodyLines'
{
PostCreditNotesRequestBodyLines' -> Maybe Int
postCreditNotesRequestBodyLines'Amount :: (GHC.Maybe.Maybe GHC.Types.Int),
PostCreditNotesRequestBodyLines' -> Maybe Text
postCreditNotesRequestBodyLines'Description :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostCreditNotesRequestBodyLines' -> Maybe Text
postCreditNotesRequestBodyLines'InvoiceLineItem :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostCreditNotesRequestBodyLines' -> Maybe Int
postCreditNotesRequestBodyLines'Quantity :: (GHC.Maybe.Maybe GHC.Types.Int),
PostCreditNotesRequestBodyLines'
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
postCreditNotesRequestBodyLines'TaxRates :: (GHC.Maybe.Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants),
PostCreditNotesRequestBodyLines'
-> PostCreditNotesRequestBodyLines'Type'
postCreditNotesRequestBodyLines'Type :: PostCreditNotesRequestBodyLines'Type',
PostCreditNotesRequestBodyLines' -> Maybe Int
postCreditNotesRequestBodyLines'UnitAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
PostCreditNotesRequestBodyLines' -> Maybe Text
postCreditNotesRequestBodyLines'UnitAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> PostCreditNotesRequestBodyLines' -> ShowS
[PostCreditNotesRequestBodyLines'] -> ShowS
PostCreditNotesRequestBodyLines' -> String
(Int -> PostCreditNotesRequestBodyLines' -> ShowS)
-> (PostCreditNotesRequestBodyLines' -> String)
-> ([PostCreditNotesRequestBodyLines'] -> ShowS)
-> Show PostCreditNotesRequestBodyLines'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostCreditNotesRequestBodyLines'] -> ShowS
$cshowList :: [PostCreditNotesRequestBodyLines'] -> ShowS
show :: PostCreditNotesRequestBodyLines' -> String
$cshow :: PostCreditNotesRequestBodyLines' -> String
showsPrec :: Int -> PostCreditNotesRequestBodyLines' -> ShowS
$cshowsPrec :: Int -> PostCreditNotesRequestBodyLines' -> ShowS
GHC.Show.Show,
PostCreditNotesRequestBodyLines'
-> PostCreditNotesRequestBodyLines' -> Bool
(PostCreditNotesRequestBodyLines'
-> PostCreditNotesRequestBodyLines' -> Bool)
-> (PostCreditNotesRequestBodyLines'
-> PostCreditNotesRequestBodyLines' -> Bool)
-> Eq PostCreditNotesRequestBodyLines'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostCreditNotesRequestBodyLines'
-> PostCreditNotesRequestBodyLines' -> Bool
$c/= :: PostCreditNotesRequestBodyLines'
-> PostCreditNotesRequestBodyLines' -> Bool
== :: PostCreditNotesRequestBodyLines'
-> PostCreditNotesRequestBodyLines' -> Bool
$c== :: PostCreditNotesRequestBodyLines'
-> PostCreditNotesRequestBodyLines' -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON PostCreditNotesRequestBodyLines' where
toJSON :: PostCreditNotesRequestBodyLines' -> Value
toJSON PostCreditNotesRequestBodyLines'
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..= PostCreditNotesRequestBodyLines' -> Maybe Int
postCreditNotesRequestBodyLines'Amount PostCreditNotesRequestBodyLines'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"description" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines' -> Maybe Text
postCreditNotesRequestBodyLines'Description PostCreditNotesRequestBodyLines'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"invoice_line_item" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines' -> Maybe Text
postCreditNotesRequestBodyLines'InvoiceLineItem PostCreditNotesRequestBodyLines'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"quantity" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines' -> Maybe Int
postCreditNotesRequestBodyLines'Quantity PostCreditNotesRequestBodyLines'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_rates" Text
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines'
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
postCreditNotesRequestBodyLines'TaxRates PostCreditNotesRequestBodyLines'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> PostCreditNotesRequestBodyLines'Type' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines'
-> PostCreditNotesRequestBodyLines'Type'
postCreditNotesRequestBodyLines'Type PostCreditNotesRequestBodyLines'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"unit_amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines' -> Maybe Int
postCreditNotesRequestBodyLines'UnitAmount PostCreditNotesRequestBodyLines'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"unit_amount_decimal" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines' -> Maybe Text
postCreditNotesRequestBodyLines'UnitAmountDecimal PostCreditNotesRequestBodyLines'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: PostCreditNotesRequestBodyLines' -> Encoding
toEncoding PostCreditNotesRequestBodyLines'
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..= PostCreditNotesRequestBodyLines' -> Maybe Int
postCreditNotesRequestBodyLines'Amount PostCreditNotesRequestBodyLines'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"description" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines' -> Maybe Text
postCreditNotesRequestBodyLines'Description PostCreditNotesRequestBodyLines'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"invoice_line_item" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines' -> Maybe Text
postCreditNotesRequestBodyLines'InvoiceLineItem PostCreditNotesRequestBodyLines'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"quantity" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines' -> Maybe Int
postCreditNotesRequestBodyLines'Quantity PostCreditNotesRequestBodyLines'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tax_rates" Text
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines'
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
postCreditNotesRequestBodyLines'TaxRates PostCreditNotesRequestBodyLines'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"type" Text -> PostCreditNotesRequestBodyLines'Type' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines'
-> PostCreditNotesRequestBodyLines'Type'
postCreditNotesRequestBodyLines'Type PostCreditNotesRequestBodyLines'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"unit_amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines' -> Maybe Int
postCreditNotesRequestBodyLines'UnitAmount PostCreditNotesRequestBodyLines'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"unit_amount_decimal" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostCreditNotesRequestBodyLines' -> Maybe Text
postCreditNotesRequestBodyLines'UnitAmountDecimal PostCreditNotesRequestBodyLines'
obj))))))))
instance Data.Aeson.Types.FromJSON.FromJSON PostCreditNotesRequestBodyLines' where
parseJSON :: Value -> Parser PostCreditNotesRequestBodyLines'
parseJSON = String
-> (Object -> Parser PostCreditNotesRequestBodyLines')
-> Value
-> Parser PostCreditNotesRequestBodyLines'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostCreditNotesRequestBodyLines'" (\Object
obj -> ((((((((Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines')
-> Parser
(Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines'
PostCreditNotesRequestBodyLines' Parser
(Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines')
-> Parser (Maybe Int)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines')
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 Int
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines')
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines')
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
"description")) Parser
(Maybe Text
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines')
-> Parser (Maybe Text)
-> Parser
(Maybe Int
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines')
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
"invoice_line_item")) Parser
(Maybe Int
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines')
-> Parser (Maybe Int)
-> Parser
(Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines')
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
"quantity")) Parser
(Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines')
-> Parser (Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants)
-> Parser
(PostCreditNotesRequestBodyLines'Type'
-> Maybe Int -> Maybe Text -> PostCreditNotesRequestBodyLines')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tax_rates")) Parser
(PostCreditNotesRequestBodyLines'Type'
-> Maybe Int -> Maybe Text -> PostCreditNotesRequestBodyLines')
-> Parser PostCreditNotesRequestBodyLines'Type'
-> Parser
(Maybe Int -> Maybe Text -> PostCreditNotesRequestBodyLines')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser PostCreditNotesRequestBodyLines'Type'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"type")) Parser
(Maybe Int -> Maybe Text -> PostCreditNotesRequestBodyLines')
-> Parser (Maybe Int)
-> Parser (Maybe Text -> PostCreditNotesRequestBodyLines')
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
"unit_amount")) Parser (Maybe Text -> PostCreditNotesRequestBodyLines')
-> Parser (Maybe Text) -> Parser PostCreditNotesRequestBodyLines'
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
"unit_amount_decimal"))
mkPostCreditNotesRequestBodyLines' ::
PostCreditNotesRequestBodyLines'Type' ->
PostCreditNotesRequestBodyLines'
mkPostCreditNotesRequestBodyLines' :: PostCreditNotesRequestBodyLines'Type'
-> PostCreditNotesRequestBodyLines'
mkPostCreditNotesRequestBodyLines' PostCreditNotesRequestBodyLines'Type'
postCreditNotesRequestBodyLines'Type =
PostCreditNotesRequestBodyLines' :: Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'Type'
-> Maybe Int
-> Maybe Text
-> PostCreditNotesRequestBodyLines'
PostCreditNotesRequestBodyLines'
{ postCreditNotesRequestBodyLines'Amount :: Maybe Int
postCreditNotesRequestBodyLines'Amount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyLines'Description :: Maybe Text
postCreditNotesRequestBodyLines'Description = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyLines'InvoiceLineItem :: Maybe Text
postCreditNotesRequestBodyLines'InvoiceLineItem = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyLines'Quantity :: Maybe Int
postCreditNotesRequestBodyLines'Quantity = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyLines'TaxRates :: Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
postCreditNotesRequestBodyLines'TaxRates = Maybe PostCreditNotesRequestBodyLines'TaxRates'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyLines'Type :: PostCreditNotesRequestBodyLines'Type'
postCreditNotesRequestBodyLines'Type = PostCreditNotesRequestBodyLines'Type'
postCreditNotesRequestBodyLines'Type,
postCreditNotesRequestBodyLines'UnitAmount :: Maybe Int
postCreditNotesRequestBodyLines'UnitAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
postCreditNotesRequestBodyLines'UnitAmountDecimal :: Maybe Text
postCreditNotesRequestBodyLines'UnitAmountDecimal = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}
data PostCreditNotesRequestBodyLines'TaxRates'Variants
=
PostCreditNotesRequestBodyLines'TaxRates'EmptyString
| PostCreditNotesRequestBodyLines'TaxRates'ListTText ([Data.Text.Internal.Text])
deriving (Int -> PostCreditNotesRequestBodyLines'TaxRates'Variants -> ShowS
[PostCreditNotesRequestBodyLines'TaxRates'Variants] -> ShowS
PostCreditNotesRequestBodyLines'TaxRates'Variants -> String
(Int -> PostCreditNotesRequestBodyLines'TaxRates'Variants -> ShowS)
-> (PostCreditNotesRequestBodyLines'TaxRates'Variants -> String)
-> ([PostCreditNotesRequestBodyLines'TaxRates'Variants] -> ShowS)
-> Show PostCreditNotesRequestBodyLines'TaxRates'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostCreditNotesRequestBodyLines'TaxRates'Variants] -> ShowS
$cshowList :: [PostCreditNotesRequestBodyLines'TaxRates'Variants] -> ShowS
show :: PostCreditNotesRequestBodyLines'TaxRates'Variants -> String
$cshow :: PostCreditNotesRequestBodyLines'TaxRates'Variants -> String
showsPrec :: Int -> PostCreditNotesRequestBodyLines'TaxRates'Variants -> ShowS
$cshowsPrec :: Int -> PostCreditNotesRequestBodyLines'TaxRates'Variants -> ShowS
GHC.Show.Show, PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'TaxRates'Variants -> Bool
(PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'TaxRates'Variants -> Bool)
-> (PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'TaxRates'Variants -> Bool)
-> Eq PostCreditNotesRequestBodyLines'TaxRates'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'TaxRates'Variants -> Bool
$c/= :: PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'TaxRates'Variants -> Bool
== :: PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'TaxRates'Variants -> Bool
$c== :: PostCreditNotesRequestBodyLines'TaxRates'Variants
-> PostCreditNotesRequestBodyLines'TaxRates'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON PostCreditNotesRequestBodyLines'TaxRates'Variants where
toJSON :: PostCreditNotesRequestBodyLines'TaxRates'Variants -> Value
toJSON (PostCreditNotesRequestBodyLines'TaxRates'ListTText [Text]
a) = [Text] -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON [Text]
a
toJSON (PostCreditNotesRequestBodyLines'TaxRates'Variants
PostCreditNotesRequestBodyLines'TaxRates'EmptyString) = Value
""
instance Data.Aeson.Types.FromJSON.FromJSON PostCreditNotesRequestBodyLines'TaxRates'Variants where
parseJSON :: Value -> Parser PostCreditNotesRequestBodyLines'TaxRates'Variants
parseJSON Value
val =
if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"" -> PostCreditNotesRequestBodyLines'TaxRates'Variants
-> Parser PostCreditNotesRequestBodyLines'TaxRates'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostCreditNotesRequestBodyLines'TaxRates'Variants
PostCreditNotesRequestBodyLines'TaxRates'EmptyString
| Bool
GHC.Base.otherwise -> case ([Text] -> PostCreditNotesRequestBodyLines'TaxRates'Variants
PostCreditNotesRequestBodyLines'TaxRates'ListTText ([Text] -> PostCreditNotesRequestBodyLines'TaxRates'Variants)
-> Result [Text]
-> Result PostCreditNotesRequestBodyLines'TaxRates'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result [Text]
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result PostCreditNotesRequestBodyLines'TaxRates'Variants
-> Result PostCreditNotesRequestBodyLines'TaxRates'Variants
-> Result PostCreditNotesRequestBodyLines'TaxRates'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result PostCreditNotesRequestBodyLines'TaxRates'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched" of
Data.Aeson.Types.Internal.Success PostCreditNotesRequestBodyLines'TaxRates'Variants
a -> PostCreditNotesRequestBodyLines'TaxRates'Variants
-> Parser PostCreditNotesRequestBodyLines'TaxRates'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostCreditNotesRequestBodyLines'TaxRates'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String -> Parser PostCreditNotesRequestBodyLines'TaxRates'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a
data PostCreditNotesRequestBodyLines'Type'
=
PostCreditNotesRequestBodyLines'Type'Other Data.Aeson.Types.Internal.Value
|
PostCreditNotesRequestBodyLines'Type'Typed Data.Text.Internal.Text
|
PostCreditNotesRequestBodyLines'Type'EnumCustomLineItem
|
PostCreditNotesRequestBodyLines'Type'EnumInvoiceLineItem
deriving (Int -> PostCreditNotesRequestBodyLines'Type' -> ShowS
[PostCreditNotesRequestBodyLines'Type'] -> ShowS
PostCreditNotesRequestBodyLines'Type' -> String
(Int -> PostCreditNotesRequestBodyLines'Type' -> ShowS)
-> (PostCreditNotesRequestBodyLines'Type' -> String)
-> ([PostCreditNotesRequestBodyLines'Type'] -> ShowS)
-> Show PostCreditNotesRequestBodyLines'Type'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostCreditNotesRequestBodyLines'Type'] -> ShowS
$cshowList :: [PostCreditNotesRequestBodyLines'Type'] -> ShowS
show :: PostCreditNotesRequestBodyLines'Type' -> String
$cshow :: PostCreditNotesRequestBodyLines'Type' -> String
showsPrec :: Int -> PostCreditNotesRequestBodyLines'Type' -> ShowS
$cshowsPrec :: Int -> PostCreditNotesRequestBodyLines'Type' -> ShowS
GHC.Show.Show, PostCreditNotesRequestBodyLines'Type'
-> PostCreditNotesRequestBodyLines'Type' -> Bool
(PostCreditNotesRequestBodyLines'Type'
-> PostCreditNotesRequestBodyLines'Type' -> Bool)
-> (PostCreditNotesRequestBodyLines'Type'
-> PostCreditNotesRequestBodyLines'Type' -> Bool)
-> Eq PostCreditNotesRequestBodyLines'Type'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostCreditNotesRequestBodyLines'Type'
-> PostCreditNotesRequestBodyLines'Type' -> Bool
$c/= :: PostCreditNotesRequestBodyLines'Type'
-> PostCreditNotesRequestBodyLines'Type' -> Bool
== :: PostCreditNotesRequestBodyLines'Type'
-> PostCreditNotesRequestBodyLines'Type' -> Bool
$c== :: PostCreditNotesRequestBodyLines'Type'
-> PostCreditNotesRequestBodyLines'Type' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON PostCreditNotesRequestBodyLines'Type' where
toJSON :: PostCreditNotesRequestBodyLines'Type' -> Value
toJSON (PostCreditNotesRequestBodyLines'Type'Other Value
val) = Value
val
toJSON (PostCreditNotesRequestBodyLines'Type'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (PostCreditNotesRequestBodyLines'Type'
PostCreditNotesRequestBodyLines'Type'EnumCustomLineItem) = Value
"custom_line_item"
toJSON (PostCreditNotesRequestBodyLines'Type'
PostCreditNotesRequestBodyLines'Type'EnumInvoiceLineItem) = Value
"invoice_line_item"
instance Data.Aeson.Types.FromJSON.FromJSON PostCreditNotesRequestBodyLines'Type' where
parseJSON :: Value -> Parser PostCreditNotesRequestBodyLines'Type'
parseJSON Value
val =
PostCreditNotesRequestBodyLines'Type'
-> Parser PostCreditNotesRequestBodyLines'Type'
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
"custom_line_item" -> PostCreditNotesRequestBodyLines'Type'
PostCreditNotesRequestBodyLines'Type'EnumCustomLineItem
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"invoice_line_item" -> PostCreditNotesRequestBodyLines'Type'
PostCreditNotesRequestBodyLines'Type'EnumInvoiceLineItem
| Bool
GHC.Base.otherwise -> Value -> PostCreditNotesRequestBodyLines'Type'
PostCreditNotesRequestBodyLines'Type'Other Value
val
)
data PostCreditNotesRequestBodyReason'
=
PostCreditNotesRequestBodyReason'Other Data.Aeson.Types.Internal.Value
|
PostCreditNotesRequestBodyReason'Typed Data.Text.Internal.Text
|
PostCreditNotesRequestBodyReason'EnumDuplicate
|
PostCreditNotesRequestBodyReason'EnumFraudulent
|
PostCreditNotesRequestBodyReason'EnumOrderChange
|
PostCreditNotesRequestBodyReason'EnumProductUnsatisfactory
deriving (Int -> PostCreditNotesRequestBodyReason' -> ShowS
[PostCreditNotesRequestBodyReason'] -> ShowS
PostCreditNotesRequestBodyReason' -> String
(Int -> PostCreditNotesRequestBodyReason' -> ShowS)
-> (PostCreditNotesRequestBodyReason' -> String)
-> ([PostCreditNotesRequestBodyReason'] -> ShowS)
-> Show PostCreditNotesRequestBodyReason'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostCreditNotesRequestBodyReason'] -> ShowS
$cshowList :: [PostCreditNotesRequestBodyReason'] -> ShowS
show :: PostCreditNotesRequestBodyReason' -> String
$cshow :: PostCreditNotesRequestBodyReason' -> String
showsPrec :: Int -> PostCreditNotesRequestBodyReason' -> ShowS
$cshowsPrec :: Int -> PostCreditNotesRequestBodyReason' -> ShowS
GHC.Show.Show, PostCreditNotesRequestBodyReason'
-> PostCreditNotesRequestBodyReason' -> Bool
(PostCreditNotesRequestBodyReason'
-> PostCreditNotesRequestBodyReason' -> Bool)
-> (PostCreditNotesRequestBodyReason'
-> PostCreditNotesRequestBodyReason' -> Bool)
-> Eq PostCreditNotesRequestBodyReason'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostCreditNotesRequestBodyReason'
-> PostCreditNotesRequestBodyReason' -> Bool
$c/= :: PostCreditNotesRequestBodyReason'
-> PostCreditNotesRequestBodyReason' -> Bool
== :: PostCreditNotesRequestBodyReason'
-> PostCreditNotesRequestBodyReason' -> Bool
$c== :: PostCreditNotesRequestBodyReason'
-> PostCreditNotesRequestBodyReason' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON PostCreditNotesRequestBodyReason' where
toJSON :: PostCreditNotesRequestBodyReason' -> Value
toJSON (PostCreditNotesRequestBodyReason'Other Value
val) = Value
val
toJSON (PostCreditNotesRequestBodyReason'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (PostCreditNotesRequestBodyReason'
PostCreditNotesRequestBodyReason'EnumDuplicate) = Value
"duplicate"
toJSON (PostCreditNotesRequestBodyReason'
PostCreditNotesRequestBodyReason'EnumFraudulent) = Value
"fraudulent"
toJSON (PostCreditNotesRequestBodyReason'
PostCreditNotesRequestBodyReason'EnumOrderChange) = Value
"order_change"
toJSON (PostCreditNotesRequestBodyReason'
PostCreditNotesRequestBodyReason'EnumProductUnsatisfactory) = Value
"product_unsatisfactory"
instance Data.Aeson.Types.FromJSON.FromJSON PostCreditNotesRequestBodyReason' where
parseJSON :: Value -> Parser PostCreditNotesRequestBodyReason'
parseJSON Value
val =
PostCreditNotesRequestBodyReason'
-> Parser PostCreditNotesRequestBodyReason'
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" -> PostCreditNotesRequestBodyReason'
PostCreditNotesRequestBodyReason'EnumDuplicate
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"fraudulent" -> PostCreditNotesRequestBodyReason'
PostCreditNotesRequestBodyReason'EnumFraudulent
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"order_change" -> PostCreditNotesRequestBodyReason'
PostCreditNotesRequestBodyReason'EnumOrderChange
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"product_unsatisfactory" -> PostCreditNotesRequestBodyReason'
PostCreditNotesRequestBodyReason'EnumProductUnsatisfactory
| Bool
GHC.Base.otherwise -> Value -> PostCreditNotesRequestBodyReason'
PostCreditNotesRequestBodyReason'Other Value
val
)
data PostCreditNotesResponse
=
PostCreditNotesResponseError GHC.Base.String
|
PostCreditNotesResponse200 CreditNote
|
PostCreditNotesResponseDefault Error
deriving (Int -> PostCreditNotesResponse -> ShowS
[PostCreditNotesResponse] -> ShowS
PostCreditNotesResponse -> String
(Int -> PostCreditNotesResponse -> ShowS)
-> (PostCreditNotesResponse -> String)
-> ([PostCreditNotesResponse] -> ShowS)
-> Show PostCreditNotesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostCreditNotesResponse] -> ShowS
$cshowList :: [PostCreditNotesResponse] -> ShowS
show :: PostCreditNotesResponse -> String
$cshow :: PostCreditNotesResponse -> String
showsPrec :: Int -> PostCreditNotesResponse -> ShowS
$cshowsPrec :: Int -> PostCreditNotesResponse -> ShowS
GHC.Show.Show, PostCreditNotesResponse -> PostCreditNotesResponse -> Bool
(PostCreditNotesResponse -> PostCreditNotesResponse -> Bool)
-> (PostCreditNotesResponse -> PostCreditNotesResponse -> Bool)
-> Eq PostCreditNotesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostCreditNotesResponse -> PostCreditNotesResponse -> Bool
$c/= :: PostCreditNotesResponse -> PostCreditNotesResponse -> Bool
== :: PostCreditNotesResponse -> PostCreditNotesResponse -> Bool
$c== :: PostCreditNotesResponse -> PostCreditNotesResponse -> Bool
GHC.Classes.Eq)