From e2ba9ef9fc9d8e9608c57a74813430f30179dfe9 Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@leastauthority.com>
Date: Tue, 5 Nov 2019 12:43:19 +0530
Subject: [PATCH] report an error for failed payments

---
 src/PaymentServer/Processors/Stripe.hs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/PaymentServer/Processors/Stripe.hs b/src/PaymentServer/Processors/Stripe.hs
index 4c17838..6b68bc2 100644
--- a/src/PaymentServer/Processors/Stripe.hs
+++ b/src/PaymentServer/Processors/Stripe.hs
@@ -35,6 +35,7 @@ import Servant
   ( Server
   , Handler
   , err400
+  , ServerError(errBody)
   , throwError
   )
 import Servant.API
@@ -154,4 +155,4 @@ charge d key (Charges token voucher amount currency) = do
     Right (Charge {}) -> do
       liftIO $ payForVoucher d voucher
       return Ok
-    Left (StripeError {}) -> throwError err400
+    Left (StripeError {}) -> throwError err400 { errBody = "Stripe charge didn't succeed" }
-- 
GitLab