summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2018-12-16 00:18:35 +0100
committerFélix Sipma <felix.sipma@no-log.org>2018-12-16 10:18:42 +0100
commit486ec5e53726da580354624777059ec4220a8dcc (patch)
tree74237d4dc31943d23336a240e2d537821437c6de
parent8695f8596acdcd9e905e77f7facc7a3b3771dc30 (diff)
Handler: use decodeLatin1 for SMS
-rw-r--r--fermedegouet-api.cabal18
-rw-r--r--src/Shop/Handler.hs3
2 files changed, 11 insertions, 10 deletions
diff --git a/fermedegouet-api.cabal b/fermedegouet-api.cabal
index dbd52b7..c8efcc9 100644
--- a/fermedegouet-api.cabal
+++ b/fermedegouet-api.cabal
@@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
--- hash: 5067711d9447795d71aa138eaffe11a8ebf93aadb82cbff0b8517618aa4f20c3
+-- hash: 84fc5327e6fd37f51b82a771470013f9701851bcfecd6ef1758f6d615f0813c9
name: fermedegouet-api
version: 0.1.0
@@ -29,6 +29,14 @@ flag dev
default: False
library
+ exposed-modules:
+ Shop.API
+ Shop.Config
+ Shop.Handler
+ Shop.Server
+ Shop.Types
+ other-modules:
+ Paths_fermedegouet_api
hs-source-dirs:
src
default-extensions: NoImplicitPrelude
@@ -58,14 +66,6 @@ library
, wai-extra
, warp
, yaml
- exposed-modules:
- Shop.API
- Shop.Config
- Shop.Handler
- Shop.Server
- Shop.Types
- other-modules:
- Paths_fermedegouet_api
default-language: Haskell2010
executable fermedegouet-api
diff --git a/src/Shop/Handler.hs b/src/Shop/Handler.hs
index b5672a1..cd9289d 100644
--- a/src/Shop/Handler.hs
+++ b/src/Shop/Handler.hs
@@ -15,6 +15,7 @@ import Control.Monad.Logger (LoggingT, runStdoutLoggingT,
import Data.Aeson (Value, encode)
import Data.Default.Class (def)
import qualified Data.Text as T
+import qualified Data.Text.Encoding as TE
import qualified Data.UUID as UUID
import Data.UUID.V4 (nextRandom)
import qualified Data.Yaml as Yaml
@@ -57,7 +58,7 @@ charge chargeform = do
$(logInfo) $ "Form validated: <"
<> email chargeform <> "> (" <> a <> ")"
$(logInfo) $ toS $ encode chargeform
- sendSMS $ SMS (getConfigSMSApiUser cfg) (getConfigSMSApiPassword cfg) (toS $ Yaml.encode chargeform)
+ sendSMS $ SMS (getConfigSMSApiUser cfg) (getConfigSMSApiPassword cfg) (TE.decodeLatin1 $ Yaml.encode chargeform)
$(logInfo) $ toS "SMS sent: <"
<> phone chargeform <> "> (" <> a <> ")"
uuid <- liftIO nextRandom