paypal-adaptive-hoops-0.11.0.0: Client for a limited part of PayPal's Adaptive Payments API

Safe HaskellNone
LanguageHaskell2010

PayPal.Adaptive

Contents

Synopsis

Client

data Client Source

Constructors

Client 

Fields

_clAppId :: Text
 
_clUserId :: Text
 
_clEnv :: Env
 
_clPassword :: Text
 
_clSig :: Text
 
_clAccountEmail :: Text

Not needed for authentication, but deposits are sent to here and withdrawals are sent from here. Must be the email associated with your PayPal app.

Instances

data Env Source

Constructors

Sandbox 
Production 

Instances

Errors

data AdaptiveErr Source

Text is an error message in all the below types.

AeShouldNotHappen is meant to cover PayPal responses to API requests that this library doesn't support sending in the first place. TODO: is this actually how we're using it?

Constructors

AeConnectionErr Text 
AeDecodeFailed ByteString Text 
AeInvalidCredentials

Just a wrapper around an AeErrCodes Int.

AeNoSuchEmail

Just a wrapper around an AeErrCodes Int. Raised when the Deposit sender email or the Withdrawal account email doesn't exist.

AeErrCodes [Int] 
AePending PayResp 
AeRefused PayResp 
AeShouldNotHappen PayResp Text 

Payment Responses

data PayResp Source

Used for forgiving attempts to parse PayPal responses. For instance, this library never expects more than one PayInfo. We still try to parse them as a list here so we can still sucessfully parse a PayResp to use in an AdaptiveError if for some reason more than one PayInfo is returned

data CompletePayResp Source

A version of PayResp for completed transactions.

Status fields are omitted since they should be complete.

Has no separate field for a PayInfo list since successful transactions will always have exactly one. Instead the pay info fields have been flattened into the top level of this structure.

data PayExecStatus Source

This refers to the processing of this request. To make sure a payment has actually gone through, check TransactionStatus instead.

PayPal returns this using the JSON object key "paymentExecStatus" in responses to Withdrawal and Deposit and "status" in responses to LookupPayment.

data PayInfo Source

Right toPayPal responses return a PayInfo along with a _piTransactionStatus Just, with some exceptions.

  1. Withdrawals to nonexistent accounts return no PayInfos.

    1. Lookups on such transactions return one PayInfo with a _piTransactionStatus of Nothing.
    2. Deposits don't return PayInfos.
    3. Lookups on such transactions return one PayInfo with a _piTransactionStatus of Nothing.

NOTE: We use the same newtype for both _piSenderTransactionId and _piTransactionStatus. They will have different values, but either can be used to look up a payment.

data Receiver Source

Constructors

Receiver 

Fields

_reAmount :: Text

Haven't converted this to Money yet because I'm not sure how to determine its currency.

_reEmail :: Text
 
_reAccountId :: Text
 

Money

data Money Source

Constructors

USD 

Fields

_usdCents :: Int
 

Instances

Lenses