{-# LANGUAGE TemplateHaskell #-} module PayPal.Adaptive.Core.PayResponse.PayStatus where import Data.Aeson.TH import Data.Char (toUpper) import Import -- | This refers to the processing of this request. To make sure a payment -- has actually gone through, check 'TransactionStatus' as well. -- -- PayPal returns this using the JSON object key "paymentExecStatus" -- in responses to Withdrawal and Deposit and "status" in responses to -- LookupPayment. -- -- https://developer.paypal.com/docs/classic/api/adaptive-payments/PaymentDetails_API_Operation/ data PayStatus = PeCreated -- ^ CREATED – The payment request was received; funds will be transferred once the payment is approved | PeCompleted -- ^ COMPLETED – The payment was successful | PePending -- ^ PENDING – The payment is awaiting processing | PeProcessing -- ^ PROCESSING – The payment is in progress | PeIncomplete -- ^ INCOMPLETE – Some transfers succeeded and some failed for a parallel payment or, -- for a delayed chained payment, secondary receivers have not been paid | PeExpired -- ^ EXPIRED -- -- NOTE: This occurs in practice, but isn't in the documentation. | PeError -- ^ ERROR – The payment failed and all attempted transfers failed or all completed transfers -- were successfully reversed | PeReversalError -- ^ REVERSALERROR – One or more transfers failed when attempting to reverse a payment deriving (Eq, Show, Read) $(deriveFromJSON defaultOptions { constructorTagModifier = map toUpper . drop 2 } ''PayStatus) $(makePrisms ''PayStatus)