{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Operations.PostTaxRates 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
postTaxRates ::
forall m.
StripeAPI.Common.MonadHTTP m =>
PostTaxRatesRequestBody ->
StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response PostTaxRatesResponse)
postTaxRates :: PostTaxRatesRequestBody
-> StripeT m (Response PostTaxRatesResponse)
postTaxRates PostTaxRatesRequestBody
body =
(Response ByteString -> Response PostTaxRatesResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response PostTaxRatesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( \Response ByteString
response_0 ->
(ByteString -> PostTaxRatesResponse)
-> Response ByteString -> Response PostTaxRatesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( (String -> PostTaxRatesResponse)
-> (PostTaxRatesResponse -> PostTaxRatesResponse)
-> Either String PostTaxRatesResponse
-> PostTaxRatesResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> PostTaxRatesResponse
PostTaxRatesResponseError PostTaxRatesResponse -> PostTaxRatesResponse
forall a. a -> a
GHC.Base.id
(Either String PostTaxRatesResponse -> PostTaxRatesResponse)
-> (ByteString -> Either String PostTaxRatesResponse)
-> ByteString
-> PostTaxRatesResponse
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) ->
TaxRate -> PostTaxRatesResponse
PostTaxRatesResponse200
(TaxRate -> PostTaxRatesResponse)
-> Either String TaxRate -> Either String PostTaxRatesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String TaxRate
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
Data.Either.Either
GHC.Base.String
TaxRate
)
| 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 -> PostTaxRatesResponse
PostTaxRatesResponseDefault
(Error -> PostTaxRatesResponse)
-> Either String Error -> Either String PostTaxRatesResponse
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 PostTaxRatesResponse
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 PostTaxRatesRequestBody
-> 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/tax_rates") [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty (PostTaxRatesRequestBody -> Maybe PostTaxRatesRequestBody
forall a. a -> Maybe a
GHC.Maybe.Just PostTaxRatesRequestBody
body) RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)
data PostTaxRatesRequestBody = PostTaxRatesRequestBody
{
PostTaxRatesRequestBody -> Maybe Bool
postTaxRatesRequestBodyActive :: (GHC.Maybe.Maybe GHC.Types.Bool),
PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyCountry :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostTaxRatesRequestBody -> Text
postTaxRatesRequestBodyDisplayName :: Data.Text.Internal.Text,
PostTaxRatesRequestBody -> Maybe [Text]
postTaxRatesRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
PostTaxRatesRequestBody -> Bool
postTaxRatesRequestBodyInclusive :: GHC.Types.Bool,
PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyJurisdiction :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostTaxRatesRequestBody -> Maybe Object
postTaxRatesRequestBodyMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
PostTaxRatesRequestBody -> Double
postTaxRatesRequestBodyPercentage :: GHC.Types.Double,
PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyState :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostTaxRatesRequestBody -> Maybe PostTaxRatesRequestBodyTaxType'
postTaxRatesRequestBodyTaxType :: (GHC.Maybe.Maybe PostTaxRatesRequestBodyTaxType')
}
deriving
( Int -> PostTaxRatesRequestBody -> ShowS
[PostTaxRatesRequestBody] -> ShowS
PostTaxRatesRequestBody -> String
(Int -> PostTaxRatesRequestBody -> ShowS)
-> (PostTaxRatesRequestBody -> String)
-> ([PostTaxRatesRequestBody] -> ShowS)
-> Show PostTaxRatesRequestBody
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostTaxRatesRequestBody] -> ShowS
$cshowList :: [PostTaxRatesRequestBody] -> ShowS
show :: PostTaxRatesRequestBody -> String
$cshow :: PostTaxRatesRequestBody -> String
showsPrec :: Int -> PostTaxRatesRequestBody -> ShowS
$cshowsPrec :: Int -> PostTaxRatesRequestBody -> ShowS
GHC.Show.Show,
PostTaxRatesRequestBody -> PostTaxRatesRequestBody -> Bool
(PostTaxRatesRequestBody -> PostTaxRatesRequestBody -> Bool)
-> (PostTaxRatesRequestBody -> PostTaxRatesRequestBody -> Bool)
-> Eq PostTaxRatesRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostTaxRatesRequestBody -> PostTaxRatesRequestBody -> Bool
$c/= :: PostTaxRatesRequestBody -> PostTaxRatesRequestBody -> Bool
== :: PostTaxRatesRequestBody -> PostTaxRatesRequestBody -> Bool
$c== :: PostTaxRatesRequestBody -> PostTaxRatesRequestBody -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON PostTaxRatesRequestBody where
toJSON :: PostTaxRatesRequestBody -> Value
toJSON PostTaxRatesRequestBody
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"active" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Maybe Bool
postTaxRatesRequestBodyActive PostTaxRatesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"country" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyCountry PostTaxRatesRequestBody
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..= PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyDescription PostTaxRatesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"display_name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Text
postTaxRatesRequestBodyDisplayName PostTaxRatesRequestBody
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..= PostTaxRatesRequestBody -> Maybe [Text]
postTaxRatesRequestBodyExpand PostTaxRatesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"inclusive" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Bool
postTaxRatesRequestBodyInclusive PostTaxRatesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"jurisdiction" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyJurisdiction PostTaxRatesRequestBody
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..= PostTaxRatesRequestBody -> Maybe Object
postTaxRatesRequestBodyMetadata PostTaxRatesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"percentage" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Double
postTaxRatesRequestBodyPercentage PostTaxRatesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"state" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyState PostTaxRatesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_type" Text -> Maybe PostTaxRatesRequestBodyTaxType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Maybe PostTaxRatesRequestBodyTaxType'
postTaxRatesRequestBodyTaxType PostTaxRatesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: PostTaxRatesRequestBody -> Encoding
toEncoding PostTaxRatesRequestBody
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"active" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Maybe Bool
postTaxRatesRequestBodyActive PostTaxRatesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"country" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyCountry PostTaxRatesRequestBody
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..= PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyDescription PostTaxRatesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"display_name" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Text
postTaxRatesRequestBodyDisplayName PostTaxRatesRequestBody
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..= PostTaxRatesRequestBody -> Maybe [Text]
postTaxRatesRequestBodyExpand PostTaxRatesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"inclusive" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Bool
postTaxRatesRequestBodyInclusive PostTaxRatesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"jurisdiction" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyJurisdiction PostTaxRatesRequestBody
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..= PostTaxRatesRequestBody -> Maybe Object
postTaxRatesRequestBodyMetadata PostTaxRatesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"percentage" Text -> Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Double
postTaxRatesRequestBodyPercentage PostTaxRatesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"state" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Maybe Text
postTaxRatesRequestBodyState PostTaxRatesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"tax_type" Text -> Maybe PostTaxRatesRequestBodyTaxType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostTaxRatesRequestBody -> Maybe PostTaxRatesRequestBodyTaxType'
postTaxRatesRequestBodyTaxType PostTaxRatesRequestBody
obj)))))))))))
instance Data.Aeson.Types.FromJSON.FromJSON PostTaxRatesRequestBody where
parseJSON :: Value -> Parser PostTaxRatesRequestBody
parseJSON = String
-> (Object -> Parser PostTaxRatesRequestBody)
-> Value
-> Parser PostTaxRatesRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostTaxRatesRequestBody" (\Object
obj -> (((((((((((Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
-> Parser
(Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody
PostTaxRatesRequestBody Parser
(Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
-> Parser (Maybe Bool)
-> Parser
(Maybe Text
-> Maybe Text
-> Text
-> Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
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
"active")) Parser
(Maybe Text
-> Maybe Text
-> Text
-> Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Text
-> Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
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
"country")) Parser
(Maybe Text
-> Text
-> Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
-> Parser (Maybe Text)
-> Parser
(Text
-> Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
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
(Text
-> Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
-> Parser Text
-> Parser
(Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
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
"display_name")) Parser
(Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
-> Parser (Maybe [Text])
-> Parser
(Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
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
(Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
-> Parser Bool
-> Parser
(Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"inclusive")) Parser
(Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
-> Parser (Maybe Text)
-> Parser
(Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
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
"jurisdiction")) Parser
(Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
-> Parser (Maybe Object)
-> Parser
(Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
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
(Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
-> Parser Double
-> Parser
(Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"percentage")) Parser
(Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody)
-> Parser (Maybe Text)
-> Parser
(Maybe PostTaxRatesRequestBodyTaxType' -> PostTaxRatesRequestBody)
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
"state")) Parser
(Maybe PostTaxRatesRequestBodyTaxType' -> PostTaxRatesRequestBody)
-> Parser (Maybe PostTaxRatesRequestBodyTaxType')
-> Parser PostTaxRatesRequestBody
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe PostTaxRatesRequestBodyTaxType')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tax_type"))
mkPostTaxRatesRequestBody ::
Data.Text.Internal.Text ->
GHC.Types.Bool ->
GHC.Types.Double ->
PostTaxRatesRequestBody
mkPostTaxRatesRequestBody :: Text -> Bool -> Double -> PostTaxRatesRequestBody
mkPostTaxRatesRequestBody Text
postTaxRatesRequestBodyDisplayName Bool
postTaxRatesRequestBodyInclusive Double
postTaxRatesRequestBodyPercentage =
PostTaxRatesRequestBody :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> Maybe [Text]
-> Bool
-> Maybe Text
-> Maybe Object
-> Double
-> Maybe Text
-> Maybe PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBody
PostTaxRatesRequestBody
{ postTaxRatesRequestBodyActive :: Maybe Bool
postTaxRatesRequestBodyActive = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
postTaxRatesRequestBodyCountry :: Maybe Text
postTaxRatesRequestBodyCountry = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postTaxRatesRequestBodyDescription :: Maybe Text
postTaxRatesRequestBodyDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postTaxRatesRequestBodyDisplayName :: Text
postTaxRatesRequestBodyDisplayName = Text
postTaxRatesRequestBodyDisplayName,
postTaxRatesRequestBodyExpand :: Maybe [Text]
postTaxRatesRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
postTaxRatesRequestBodyInclusive :: Bool
postTaxRatesRequestBodyInclusive = Bool
postTaxRatesRequestBodyInclusive,
postTaxRatesRequestBodyJurisdiction :: Maybe Text
postTaxRatesRequestBodyJurisdiction = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postTaxRatesRequestBodyMetadata :: Maybe Object
postTaxRatesRequestBodyMetadata = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
postTaxRatesRequestBodyPercentage :: Double
postTaxRatesRequestBodyPercentage = Double
postTaxRatesRequestBodyPercentage,
postTaxRatesRequestBodyState :: Maybe Text
postTaxRatesRequestBodyState = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postTaxRatesRequestBodyTaxType :: Maybe PostTaxRatesRequestBodyTaxType'
postTaxRatesRequestBodyTaxType = Maybe PostTaxRatesRequestBodyTaxType'
forall a. Maybe a
GHC.Maybe.Nothing
}
data PostTaxRatesRequestBodyTaxType'
=
PostTaxRatesRequestBodyTaxType'Other Data.Aeson.Types.Internal.Value
|
PostTaxRatesRequestBodyTaxType'Typed Data.Text.Internal.Text
|
PostTaxRatesRequestBodyTaxType'EnumGst
|
PostTaxRatesRequestBodyTaxType'EnumHst
|
PostTaxRatesRequestBodyTaxType'EnumPst
|
PostTaxRatesRequestBodyTaxType'EnumQst
|
PostTaxRatesRequestBodyTaxType'EnumSalesTax
|
PostTaxRatesRequestBodyTaxType'EnumVat
deriving (Int -> PostTaxRatesRequestBodyTaxType' -> ShowS
[PostTaxRatesRequestBodyTaxType'] -> ShowS
PostTaxRatesRequestBodyTaxType' -> String
(Int -> PostTaxRatesRequestBodyTaxType' -> ShowS)
-> (PostTaxRatesRequestBodyTaxType' -> String)
-> ([PostTaxRatesRequestBodyTaxType'] -> ShowS)
-> Show PostTaxRatesRequestBodyTaxType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostTaxRatesRequestBodyTaxType'] -> ShowS
$cshowList :: [PostTaxRatesRequestBodyTaxType'] -> ShowS
show :: PostTaxRatesRequestBodyTaxType' -> String
$cshow :: PostTaxRatesRequestBodyTaxType' -> String
showsPrec :: Int -> PostTaxRatesRequestBodyTaxType' -> ShowS
$cshowsPrec :: Int -> PostTaxRatesRequestBodyTaxType' -> ShowS
GHC.Show.Show, PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBodyTaxType' -> Bool
(PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBodyTaxType' -> Bool)
-> (PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBodyTaxType' -> Bool)
-> Eq PostTaxRatesRequestBodyTaxType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBodyTaxType' -> Bool
$c/= :: PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBodyTaxType' -> Bool
== :: PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBodyTaxType' -> Bool
$c== :: PostTaxRatesRequestBodyTaxType'
-> PostTaxRatesRequestBodyTaxType' -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON PostTaxRatesRequestBodyTaxType' where
toJSON :: PostTaxRatesRequestBodyTaxType' -> Value
toJSON (PostTaxRatesRequestBodyTaxType'Other Value
val) = Value
val
toJSON (PostTaxRatesRequestBodyTaxType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumGst) = Value
"gst"
toJSON (PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumHst) = Value
"hst"
toJSON (PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumPst) = Value
"pst"
toJSON (PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumQst) = Value
"qst"
toJSON (PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumSalesTax) = Value
"sales_tax"
toJSON (PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumVat) = Value
"vat"
instance Data.Aeson.Types.FromJSON.FromJSON PostTaxRatesRequestBodyTaxType' where
parseJSON :: Value -> Parser PostTaxRatesRequestBodyTaxType'
parseJSON Value
val =
PostTaxRatesRequestBodyTaxType'
-> Parser PostTaxRatesRequestBodyTaxType'
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
"gst" -> PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumGst
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"hst" -> PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumHst
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"pst" -> PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumPst
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"qst" -> PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumQst
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"sales_tax" -> PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumSalesTax
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"vat" -> PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'EnumVat
| Bool
GHC.Base.otherwise -> Value -> PostTaxRatesRequestBodyTaxType'
PostTaxRatesRequestBodyTaxType'Other Value
val
)
data PostTaxRatesResponse
=
PostTaxRatesResponseError GHC.Base.String
|
PostTaxRatesResponse200 TaxRate
|
PostTaxRatesResponseDefault Error
deriving (Int -> PostTaxRatesResponse -> ShowS
[PostTaxRatesResponse] -> ShowS
PostTaxRatesResponse -> String
(Int -> PostTaxRatesResponse -> ShowS)
-> (PostTaxRatesResponse -> String)
-> ([PostTaxRatesResponse] -> ShowS)
-> Show PostTaxRatesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostTaxRatesResponse] -> ShowS
$cshowList :: [PostTaxRatesResponse] -> ShowS
show :: PostTaxRatesResponse -> String
$cshow :: PostTaxRatesResponse -> String
showsPrec :: Int -> PostTaxRatesResponse -> ShowS
$cshowsPrec :: Int -> PostTaxRatesResponse -> ShowS
GHC.Show.Show, PostTaxRatesResponse -> PostTaxRatesResponse -> Bool
(PostTaxRatesResponse -> PostTaxRatesResponse -> Bool)
-> (PostTaxRatesResponse -> PostTaxRatesResponse -> Bool)
-> Eq PostTaxRatesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostTaxRatesResponse -> PostTaxRatesResponse -> Bool
$c/= :: PostTaxRatesResponse -> PostTaxRatesResponse -> Bool
== :: PostTaxRatesResponse -> PostTaxRatesResponse -> Bool
$c== :: PostTaxRatesResponse -> PostTaxRatesResponse -> Bool
GHC.Classes.Eq)