| Copyright | (C) 2016 Braden Walters |
|---|---|
| License | MIT (see LICENSE file) |
| Maintainer | Braden Walters <vc@braden-walters.info> |
| Stability | experimental |
| Portability | ghc |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.Payments.PayPal
Description
- data UseHttpMethod
- data PayPalOperations :: * -> * where
- PPOPure :: a -> PayPalOperations a
- PPOBind :: PayPalOperations a -> (a -> PayPalOperations b) -> PayPalOperations b
- PayPalOperation :: FromJSON a => {..} -> PayPalOperations a
- type JSONText = ByteString
- type ErrorMessage = String
- data PayPalError
- execPayPal :: FromJSON a => EnvironmentUrl -> ClientID -> Secret -> PayPalOperations a -> IO (Either PayPalError a)
- execPayPalOpers :: EnvironmentUrl -> ClientID -> Secret -> AccessTokenWithExpiration -> PayPalOperations a -> IO (Either PayPalError (a, AccessTokenWithExpiration))
Documentation
data UseHttpMethod Source #
HTTP method to use in the request (GET/POST).
Constructors
| UseHttpGet | |
| UseHttpPost Payload | |
| UseHttpPatch Payload |
Instances
data PayPalOperations :: * -> * where Source #
A monad composing multiple PayPal operations which are to be performed. The result can be executed using the execPayPal function.
Constructors
| PPOPure :: a -> PayPalOperations a | |
| PPOBind :: PayPalOperations a -> (a -> PayPalOperations b) -> PayPalOperations b | |
| PayPalOperation :: FromJSON a => {..} -> PayPalOperations a | |
Fields
| |
type JSONText = ByteString Source #
type ErrorMessage = String Source #
data PayPalError Source #
Constructors
| HttpStatusError Int | |
| ResponseParseError ErrorMessage JSONText | |
| HttpError HttpException | |
| OtherError String |
Instances
execPayPal :: FromJSON a => EnvironmentUrl -> ClientID -> Secret -> PayPalOperations a -> IO (Either PayPalError a) Source #
Authenticate with PayPal and then interact with the service.
execPayPalOpers :: EnvironmentUrl -> ClientID -> Secret -> AccessTokenWithExpiration -> PayPalOperations a -> IO (Either PayPalError (a, AccessTokenWithExpiration)) Source #
Executes a PayPalOperations monad as IO. Because the access token can expire and needs to be renewed, this function returns the desired value and the most current access token when successful.