draft out user notification
This commit is contained in:
parent
04d5e3ff8a
commit
1e4e915899
3 changed files with 13 additions and 3 deletions
4
TODO.md
4
TODO.md
|
@ -5,8 +5,8 @@
|
|||
### Required
|
||||
|
||||
- [ ] E-Mail notification
|
||||
- [ ] Security mechanism has to be triggered, if present
|
||||
- [ ] Buy products in stock
|
||||
- [x] Security mechanism has to be triggered, if present
|
||||
- [x] Buy products in stock
|
||||
|
||||
### Optional
|
||||
|
||||
|
|
|
@ -43,12 +43,14 @@ buy auth pds = do
|
|||
void $ addToUserBalance auid (-price) conn
|
||||
newBalance <- userBalanceSelect conn auid
|
||||
userUpdateTimestamp auth
|
||||
return $ PurchaseResult
|
||||
let result = PurchaseResult
|
||||
( if newBalance < 0
|
||||
then PurchaseDebtful
|
||||
else PurchaseOK
|
||||
)
|
||||
missing
|
||||
userNotify auth result
|
||||
return result
|
||||
Nothing -> do
|
||||
void $ insertNewJournalEntry
|
||||
(JournalSubmit
|
||||
|
|
|
@ -142,3 +142,11 @@ userTransfer Nothing _ =
|
|||
throwError $ err401
|
||||
{ errBody = "No Authentication present."
|
||||
}
|
||||
|
||||
userNotify
|
||||
:: Maybe (Int, AuthMethod)
|
||||
-> [PurchaseDetail]
|
||||
-> PurchaseResult
|
||||
-> MateHandler ()
|
||||
userNotify (Just (auid, method)) boughtItems (PruchaseResult flag missing) = do
|
||||
|
||||
|
|
Loading…
Reference in a new issue