Add WC Order Key to payment flow
This commit is contained in:
parent
d5bbf5e30c
commit
cb9b5cd411
2 changed files with 5 additions and 2 deletions
|
@ -678,6 +678,7 @@ routes pipe config = do
|
||||||
curr <- param "currency"
|
curr <- param "currency"
|
||||||
amount <- param "amount"
|
amount <- param "amount"
|
||||||
sUrl <- param "siteurl"
|
sUrl <- param "siteurl"
|
||||||
|
orderKey <- param "orderkey"
|
||||||
res <- liftAndCatchIO $ run (findWooToken (read oid))
|
res <- liftAndCatchIO $ run (findWooToken (read oid))
|
||||||
let c = cast' . Doc =<< res
|
let c = cast' . Doc =<< res
|
||||||
case c of
|
case c of
|
||||||
|
@ -733,7 +734,8 @@ routes pipe config = do
|
||||||
amount
|
amount
|
||||||
]
|
]
|
||||||
False
|
False
|
||||||
(T.concat [T.pack sUrl, "-", ordId])
|
(T.concat
|
||||||
|
[T.pack sUrl, "-", ordId, "-", orderKey])
|
||||||
""
|
""
|
||||||
newId <- liftAndCatchIO $ run (insertWooOrder newOrder)
|
newId <- liftAndCatchIO $ run (insertWooOrder newOrder)
|
||||||
status ok200
|
status ok200
|
||||||
|
@ -1138,7 +1140,7 @@ scanPayments config pipe = do
|
||||||
case wT of
|
case wT of
|
||||||
Nothing -> error "Failed to read WooCommerce token"
|
Nothing -> error "Failed to read WooCommerce token"
|
||||||
Just wt -> do
|
Just wt -> do
|
||||||
let iReg = mkRegex "(.*)-(.*)"
|
let iReg = mkRegex "(.*)-(.*)-.*"
|
||||||
let iResult =
|
let iResult =
|
||||||
matchAllText
|
matchAllText
|
||||||
iReg
|
iReg
|
||||||
|
|
|
@ -304,6 +304,7 @@ main = do
|
||||||
, ("currency", Just "usd")
|
, ("currency", Just "usd")
|
||||||
, ("amount", Just "100.0")
|
, ("amount", Just "100.0")
|
||||||
, ("date", Just "2022-12-01")
|
, ("date", Just "2022-12-01")
|
||||||
|
, ("orderkey", Just "wc_order_m7qiJ1dNrGDYE")
|
||||||
]
|
]
|
||||||
res <- httpJSON req
|
res <- httpJSON req
|
||||||
getResponseStatus (res :: Response A.Value) `shouldBe` ok200
|
getResponseStatus (res :: Response A.Value) `shouldBe` ok200
|
||||||
|
|
Loading…
Reference in a new issue