{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
module Web.Stripe.Transfer
(
CreateTransfer
, createTransfer
, GetTransfer
, getTransfer
, UpdateTransfer
, updateTransfer
, CancelTransfer
, cancelTransfer
, GetTransfers
, getTransfers
, Amount (..)
, BankAccountId (..)
, Card (..)
, CardId (..)
, Created (..)
, Currency (..)
, Date (..)
, Description (..)
, EndingBefore (..)
, ExpandParams (..)
, Recipient (..)
, RecipientId (..)
, StartingAfter (..)
, StatementDescription (..)
, StripeList (..)
, Transfer (..)
, TransferId (..)
, TransferStatus (..)
, TransferType (..)
, Limit (..)
) where
import Web.Stripe.StripeRequest (Method (GET, POST),
StripeHasParam, StripeRequest (..),
StripeReturn, ToStripeParam(..),
mkStripeRequest)
import Web.Stripe.Util ((</>))
import Web.Stripe.Types (Amount(..), BankAccountId(..), Card(..),
CardId(..), Created(..),Currency (..),
Date(..), EndingBefore(..),
ExpandParams(..),
Limit(..), MetaData(..), Recipient (..),
RecipientId(..), StartingAfter(..),
StatementDescription(..),
StripeList (..), Transfer (..),
TransferId (..), TransferStatus (..),
Description(..), TransferType (..))
createTransfer
:: RecipientId
-> Amount
-> Currency
-> StripeRequest CreateTransfer
createTransfer
recipientid
amount
currency = request
where request = mkStripeRequest POST url params
url = "transfers"
params = toStripeParam recipientid $
toStripeParam amount $
toStripeParam currency $
[]
data CreateTransfer
type instance StripeReturn CreateTransfer = Transfer
instance StripeHasParam CreateTransfer Description
instance StripeHasParam CreateTransfer BankAccountId
instance StripeHasParam CreateTransfer CardId
instance StripeHasParam CreateTransfer StatementDescription
instance StripeHasParam CreateTransfer MetaData
getTransfer
:: TransferId
-> StripeRequest GetTransfer
getTransfer
(TransferId transferid)
= request
where request = mkStripeRequest GET url params
url = "transfers" </> transferid
params = []
data GetTransfer
type instance StripeReturn GetTransfer = Transfer
instance StripeHasParam GetTransfer ExpandParams
updateTransfer
:: TransferId
-> StripeRequest UpdateTransfer
updateTransfer
(TransferId transferid)
= request
where request = mkStripeRequest POST url params
url = "transfers" </> transferid
params = []
data UpdateTransfer
type instance StripeReturn UpdateTransfer = Transfer
instance StripeHasParam UpdateTransfer Description
instance StripeHasParam UpdateTransfer MetaData
cancelTransfer
:: TransferId
-> StripeRequest CancelTransfer
cancelTransfer (TransferId transferid) = request
where request = mkStripeRequest POST url params
url = "transfers" </> transferid </> "cancel"
params = []
data CancelTransfer
type instance StripeReturn CancelTransfer = Transfer
getTransfers
:: StripeRequest GetTransfers
getTransfers
= request
where request = mkStripeRequest GET url params
url = "transfers"
params = []
data GetTransfers
type instance StripeReturn GetTransfers = StripeList Transfer
instance StripeHasParam GetTransfers ExpandParams
instance StripeHasParam GetTransfers Created
instance StripeHasParam GetTransfers Date
instance StripeHasParam GetTransfers (EndingBefore TransferId)
instance StripeHasParam GetTransfers Limit
instance StripeHasParam GetTransfers RecipientId
instance StripeHasParam GetTransfers (StartingAfter TransferId)
instance StripeHasParam GetTransfers TransferStatus