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 ### Required
- [ ] E-Mail notification - [ ] E-Mail notification
- [ ] Security mechanism has to be triggered, if present - [x] Security mechanism has to be triggered, if present
- [ ] Buy products in stock - [x] Buy products in stock
### Optional ### Optional

View file

@ -43,12 +43,14 @@ buy auth pds = do
void $ addToUserBalance auid (-price) conn void $ addToUserBalance auid (-price) conn
newBalance <- userBalanceSelect conn auid newBalance <- userBalanceSelect conn auid
userUpdateTimestamp auth userUpdateTimestamp auth
return $ PurchaseResult let result = PurchaseResult
( if newBalance < 0 ( if newBalance < 0
then PurchaseDebtful then PurchaseDebtful
else PurchaseOK else PurchaseOK
) )
missing missing
userNotify auth result
return result
Nothing -> do Nothing -> do
void $ insertNewJournalEntry void $ insertNewJournalEntry
(JournalSubmit (JournalSubmit

View file

@ -142,3 +142,11 @@ userTransfer Nothing _ =
throwError $ err401 throwError $ err401
{ errBody = "No Authentication present." { errBody = "No Authentication present."
} }
userNotify
:: Maybe (Int, AuthMethod)
-> [PurchaseDetail]
-> PurchaseResult
-> MateHandler ()
userNotify (Just (auid, method)) boughtItems (PruchaseResult flag missing) = do