{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
module Web.Stripe.InvoiceItem
(
CreateInvoiceItem
, createInvoiceItem
, GetInvoiceItem
, getInvoiceItem
, UpdateInvoiceItem
, updateInvoiceItem
, DeleteInvoiceItem
, deleteInvoiceItem
, GetInvoiceItems
, getInvoiceItems
, InvoiceItemId (..)
, InvoiceItem (..)
, Created (..)
, CustomerId (..)
, Currency (..)
, EndingBefore (..)
, ExpandParams (..)
, InvoiceId (..)
, Invoice (..)
, Limit (..)
, SubscriptionId (..)
, StartingAfter (..)
, StripeDeleteResult (..)
, StripeList (..)
, Description (..)
, Amount (..)
) where
import Web.Stripe.StripeRequest (Method (GET, POST, DELETE),
StripeHasParam, StripeRequest (..),
StripeReturn, ToStripeParam(..),
mkStripeRequest)
import Web.Stripe.Util ((</>))
import Web.Stripe.Types (Amount(..), Created(..), Currency (..),
CustomerId (..), Description(..),
InvoiceId (..), InvoiceItem (..), Invoice(..),
InvoiceItemId (..), Limit(..), StartingAfter(..), EndingBefore(..),
StripeDeleteResult (..), ExpandParams(..),
SubscriptionId (..), StripeList(..), MetaData(..))
import Web.Stripe.Types.Util (getInvoiceItemId)
createInvoiceItem
:: CustomerId
-> Amount
-> Currency
-> StripeRequest CreateInvoiceItem
createInvoiceItem
customerid
amount
currency = request
where request = mkStripeRequest POST url params
url = "invoiceitems"
params = toStripeParam customerid $
toStripeParam amount $
toStripeParam currency $
[]
data CreateInvoiceItem
type instance StripeReturn CreateInvoiceItem = InvoiceItem
instance StripeHasParam CreateInvoiceItem InvoiceId
instance StripeHasParam CreateInvoiceItem SubscriptionId
instance StripeHasParam CreateInvoiceItem Description
instance StripeHasParam CreateInvoiceItem MetaData
getInvoiceItem
:: InvoiceItemId
-> StripeRequest GetInvoiceItem
getInvoiceItem
invoiceitemid = request
where request = mkStripeRequest GET url params
url = "invoiceitems" </> getInvoiceItemId invoiceitemid
params = []
data GetInvoiceItem
type instance StripeReturn GetInvoiceItem = InvoiceItem
instance StripeHasParam GetInvoiceItem ExpandParams
updateInvoiceItem
:: InvoiceItemId
-> StripeRequest UpdateInvoiceItem
updateInvoiceItem
invoiceitemid
= request
where request = mkStripeRequest POST url params
url = "invoiceitems" </> getInvoiceItemId invoiceitemid
params = []
data UpdateInvoiceItem
type instance StripeReturn UpdateInvoiceItem = InvoiceItem
instance StripeHasParam UpdateInvoiceItem Amount
instance StripeHasParam UpdateInvoiceItem Description
instance StripeHasParam UpdateInvoiceItem MetaData
deleteInvoiceItem
:: InvoiceItemId
-> StripeRequest DeleteInvoiceItem
deleteInvoiceItem
invoiceitemid = request
where request = mkStripeRequest DELETE url params
url = "invoiceitems" </> getInvoiceItemId invoiceitemid
params = []
data DeleteInvoiceItem
type instance StripeReturn DeleteInvoiceItem = StripeDeleteResult
getInvoiceItems
:: StripeRequest GetInvoiceItems
getInvoiceItems = request
where request = mkStripeRequest GET url params
url = "invoiceitems"
params = []
data GetInvoiceItems
type instance StripeReturn GetInvoiceItems = (StripeList InvoiceItem)
instance StripeHasParam GetInvoiceItems ExpandParams
instance StripeHasParam GetInvoiceItems Created
instance StripeHasParam GetInvoiceItems CustomerId
instance StripeHasParam GetInvoiceItems (EndingBefore InvoiceItemId)
instance StripeHasParam GetInvoiceItems Limit
instance StripeHasParam GetInvoiceItems (StartingAfter InvoiceItemId)