Add WC Order Key to payment flow

This commit is contained in:
Rene Vergara 2022-12-13 14:01:51 -06:00
parent d5bbf5e30c
commit cb9b5cd411
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
2 changed files with 5 additions and 2 deletions

View File

@ -678,6 +678,7 @@ routes pipe config = do
curr <- param "currency"
amount <- param "amount"
sUrl <- param "siteurl"
orderKey <- param "orderkey"
res <- liftAndCatchIO $ run (findWooToken (read oid))
let c = cast' . Doc =<< res
case c of
@ -733,7 +734,8 @@ routes pipe config = do
amount
]
False
(T.concat [T.pack sUrl, "-", ordId])
(T.concat
[T.pack sUrl, "-", ordId, "-", orderKey])
""
newId <- liftAndCatchIO $ run (insertWooOrder newOrder)
status ok200
@ -1138,7 +1140,7 @@ scanPayments config pipe = do
case wT of
Nothing -> error "Failed to read WooCommerce token"
Just wt -> do
let iReg = mkRegex "(.*)-(.*)"
let iReg = mkRegex "(.*)-(.*)-.*"
let iResult =
matchAllText
iReg

View File

@ -304,6 +304,7 @@ main = do
, ("currency", Just "usd")
, ("amount", Just "100.0")
, ("date", Just "2022-12-01")
, ("orderkey", Just "wc_order_m7qiJ1dNrGDYE")
]
res <- httpJSON req
getResponseStatus (res :: Response A.Value) `shouldBe` ok200