module Web.Stripe.ApplicationFee
(
getApplicationFee
, getApplicationFeeExpanded
, getApplicationFees
, getApplicationFeesExpanded
, ApplicationId (..)
, ApplicationFee (..)
, FeeId (..)
, StripeList (..)
, EndingBefore
, StartingAfter
, Limit
, ExpandParams
, ConnectApp (..)
) where
import Web.Stripe.Client.Internal (Method (GET), Stripe,
StripeRequest (..), callAPI,
getParams, toText, (</>), toExpandable)
import Web.Stripe.Types (ApplicationFee (..),
ApplicationId (..), ConnectApp (..),
EndingBefore, FeeId (..),
Limit, StartingAfter, ExpandParams,
StripeList (..))
getApplicationFee
:: FeeId
-> Stripe ApplicationFee
getApplicationFee
feeid = getApplicationFeeExpanded feeid []
getApplicationFeeExpanded
:: FeeId
-> ExpandParams
-> Stripe ApplicationFee
getApplicationFeeExpanded
(FeeId feeid)
expandParams = callAPI request
where request = StripeRequest GET url params
url = "application_fees" </> feeid
params = toExpandable expandParams
getApplicationFees
:: Maybe Limit
-> StartingAfter FeeId
-> EndingBefore FeeId
-> Stripe (StripeList ApplicationFee)
getApplicationFees
limit
startingAfter
endingBefore =
getApplicationFeesExpanded
limit startingAfter endingBefore []
getApplicationFeesExpanded
:: Maybe Limit
-> StartingAfter FeeId
-> EndingBefore FeeId
-> ExpandParams
-> Stripe (StripeList ApplicationFee)
getApplicationFeesExpanded
limit
startingAfter
endingBefore
expandParams = callAPI request
where request = StripeRequest GET url params
url = "application_fees"
params = getParams [
("limit", toText `fmap` limit )
, ("starting_after", (\(FeeId x) -> x) `fmap` startingAfter)
, ("ending_before", (\(FeeId x) -> x) `fmap` endingBefore)
] ++ toExpandable expandParams