{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
module Web.Stripe.Refund
(
CreateRefund
, createRefund
, GetRefund
, getRefund
, GetRefunds
, getRefunds
, UpdateRefund
, updateRefund
, Amount (..)
, Charge (..)
, ChargeId (..)
, EndingBefore (..)
, ExpandParams (..)
, Refund (..)
, RefundApplicationFee(..)
, RefundReason (..)
, RefundId (..)
, StripeList (..)
) where
import Web.Stripe.StripeRequest (Method (GET, POST),
StripeHasParam, StripeReturn,
StripeRequest (..), mkStripeRequest)
import Web.Stripe.Util ((</>))
import Web.Stripe.Types (Amount(..), Charge (..), ChargeId (..),
EndingBefore(..), Limit(..),
MetaData(..), Refund (..),
RefundApplicationFee(..),
RefundId (..), RefundReason(..),
StartingAfter(..), ExpandParams(..),
StripeList (..))
import Web.Stripe.Types.Util (getChargeId)
createRefund
:: ChargeId
-> StripeRequest CreateRefund
createRefund
chargeid = request
where request = mkStripeRequest POST url params
url = "charges" </> getChargeId chargeid </> "refunds"
params = []
data CreateRefund
type instance StripeReturn CreateRefund = Refund
instance StripeHasParam CreateRefund Amount
instance StripeHasParam CreateRefund RefundApplicationFee
instance StripeHasParam CreateRefund RefundReason
instance StripeHasParam CreateRefund MetaData
getRefund
:: ChargeId
-> RefundId
-> StripeRequest GetRefund
getRefund
chargeid
(RefundId refundid) = request
where request = mkStripeRequest GET url params
url = "charges" </> getChargeId chargeid </> "refunds" </> refundid
params = []
data GetRefund
type instance StripeReturn GetRefund = Refund
instance StripeHasParam GetRefund ExpandParams
updateRefund
:: ChargeId
-> RefundId
-> StripeRequest UpdateRefund
updateRefund
chargeid
(RefundId refid)
= request
where request = mkStripeRequest POST url params
url = "charges" </> getChargeId chargeid </> "refunds" </> refid
params = []
data UpdateRefund
type instance StripeReturn UpdateRefund = Refund
instance StripeHasParam UpdateRefund MetaData
getRefunds
:: ChargeId
-> StripeRequest GetRefunds
getRefunds
chargeid = request
where request = mkStripeRequest GET url params
url = "charges" </> getChargeId chargeid </> "refunds"
params = []
data GetRefunds
type instance StripeReturn GetRefunds = StripeList Refund
instance StripeHasParam GetRefunds ExpandParams
instance StripeHasParam GetRefunds (EndingBefore RefundId)
instance StripeHasParam GetRefunds Limit
instance StripeHasParam GetRefunds (StartingAfter RefundId)