diff --git a/src/ZGoBackend.hs b/src/ZGoBackend.hs index 7d6f002..4261731 100644 --- a/src/ZGoBackend.hs +++ b/src/ZGoBackend.hs @@ -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 diff --git a/test/Spec.hs b/test/Spec.hs index f2c4494..6e6a943 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -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