Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Client = Client {}
- data Environment
- clUserId :: Lens' Client Text
- clSignature :: Lens' Client Text
- clPassword :: Lens' Client Text
- clEnvironment :: Lens' Client Environment
- clAppId :: Lens' Client Text
- clAccountEmail :: Lens' Client Text
- _Production :: Prism' Environment ()
- _Sandbox :: Prism' Environment ()
- data AdaptiveError
- data ErrorResponse = ErrorResponse {
- _unErrorResponse :: [PayError]
- data PayError = PayError {}
- newtype ErrorCode = ErrorCode {
- _unErrorCode :: Int
- invalidCredentials :: ErrorCode
- noSuchEmail :: ErrorCode
- unErrorCode :: Iso' ErrorCode Int
- unErrorResponse :: Iso' ErrorResponse [PayError]
- errorMessage :: Lens' PayError Text
- errorCode :: Lens' PayError ErrorCode
- _AeErrorResponse :: Prism' AdaptiveError (ByteString, ErrorResponse)
- _AeDecodeFailed :: Prism' AdaptiveError (ByteString, Text)
- _AeConnectionError :: Prism' AdaptiveError SomeException
- data PayResponse = PayResponse {
- _prPayError :: Maybe Text
- _prPayStatus :: PayStatus
- _prPayKey :: PayKey
- _prPaymentInfos :: [PaymentInfo]
- prPaymentInfos :: Lens' PayResponse [PaymentInfo]
- prPayStatus :: Lens' PayResponse PayStatus
- prPayKey :: Lens' PayResponse PayKey
- prPayError :: Lens' PayResponse (Maybe Text)
- data CompletePayResponse = CompletePayResponse {
- _cpPayKey :: PayKey
- _cpReceiver :: Receiver
- _cpTransactionId :: TransactionId
- _cpSenderTransactionId :: TransactionId
- data NotComplete
- checkComplete :: PayResponse -> Either NotComplete CompletePayResponse
- getPaymentInfo :: PayResponse -> Either NotComplete PaymentInfo
- cpTransactionId :: Lens' CompletePayResponse TransactionId
- cpSenderTransactionId :: Lens' CompletePayResponse TransactionId
- cpReceiver :: Lens' CompletePayResponse Receiver
- cpPayKey :: Lens' CompletePayResponse PayKey
- _NcShouldNotHappen :: Prism' NotComplete Text
- _NcFailed :: Prism' NotComplete Text
- _NcIncomplete :: Prism' NotComplete Text
- data Money = USD {}
- m2Currency :: Money -> Text
- m2PayPal :: Money -> String
Client
Client | |
|
data Environment Source
_Production :: Prism' Environment () Source
_Sandbox :: Prism' Environment () Source
Error
data AdaptiveError 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?
data ErrorResponse Source
noSuchEmail :: ErrorCode Source
Raised when the Deposit sender email or the Withdrawal account email doesn't exist.
PayResponse
data PayResponse Source
Used for forgiving attempts to parse PayPal responses. For instance,
this library never expects more than one PaymentInfo. 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 PaymentInfo
is returned.
https://developer.paypal.com/docs/classic/api/adaptive-payments/Pay_API_Operation/
PayResponse | |
|
prPaymentInfos :: Lens' PayResponse [PaymentInfo] Source
prPayStatus :: Lens' PayResponse PayStatus Source
prPayKey :: Lens' PayResponse PayKey Source
Processing
data CompletePayResponse Source
A version of PayResponse
for completed transactions.
Status fields are omitted since they should be complete.
Has no separate field for a PaymentInfo
list since successful transactions
will always have exactly one. Instead the pay info fields have been
flattened into the top level of this structure.
CompletePayResponse | |
|
data NotComplete Source
A high level data type that tries to summarize the status
of a payment in simple terms (meant to be used in an Either
,
e.g. Either
NotComplete
CompletePayResponse
).
getPaymentInfo :: PayResponse -> Either NotComplete PaymentInfo Source
cpTransactionId :: Lens' CompletePayResponse TransactionId Source
cpSenderTransactionId :: Lens' CompletePayResponse TransactionId Source
cpReceiver :: Lens' CompletePayResponse Receiver Source
cpPayKey :: Lens' CompletePayResponse PayKey Source
Money
m2Currency :: Money -> Text Source