draft out user notification

This commit is contained in:
nek0 2021-02-15 19:00:29 +01:00
parent 04d5e3ff8a
commit 1e4e915899
3 changed files with 13 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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