Skip to content
Snippets Groups Projects
Commit 2bd04131 authored by Ramakrishnan Muthukrishnan's avatar Ramakrishnan Muthukrishnan
Browse files

in case of voucher mismatch, return http 500 status

If for "some reason" Stripe servers returned a mismatched voucher
code, return http 500 status.
parent 2f1a2dc0
No related branches found
No related tags found
1 merge request!30Expose a browser facing API for charge
......@@ -38,6 +38,7 @@ import Servant
( Server
, Handler
, err400
, err500
, ServerError(errBody)
, throwError
)
......@@ -169,7 +170,7 @@ charge d key (Charges token voucher amount currency) = do
liftIO $ payForVoucher d voucher
return Ok
else
throwError err400 { errBody = "Voucher code mismatch" }
throwError err500 { errBody = "Voucher code mismatch" }
_ -> throwError err400 { errBody = "Voucher code not found" }
Left StripeError {} -> throwError err400 { errBody = "Stripe charge didn't succeed" }
where
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment