From 25fad17363c42a6fb2c23180336488cc03d834e0 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 28 Feb 2023 11:19:08 -0600 Subject: [PATCH] Implement enhancements for #3 --- CHANGELOG.md | 1 + package.yaml | 2 +- src/Xero.hs | 8 +++++--- src/ZGoBackend.hs | 1 + zgo-backend.cabal | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 199c303..199c223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Changed - Remove old code for PIN generation +- Xero reference field to include the amount of ZEC received ## [1.2.5] - 2023-02-01 diff --git a/package.yaml b/package.yaml index e1d9519..77e2dc7 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: zgo-backend -version: 1.2.5 +version: 1.2.6 git: "https://git.vergara.tech/Vergara_Tech/zgo-backend" license: BOSL author: "Rene Vergara" diff --git a/src/Xero.hs b/src/Xero.hs index 14091ce..0f71d64 100644 --- a/src/Xero.hs +++ b/src/Xero.hs @@ -410,8 +410,9 @@ getXeroInvoice pipe dbName inv address = do Right iData -> return $ Just (head $ xir_invs iData) _ -> return Nothing -payXeroInvoice :: Pipe -> T.Text -> T.Text -> T.Text -> Double -> IO () -payXeroInvoice pipe dbName inv address amt = do +payXeroInvoice :: + Pipe -> T.Text -> T.Text -> T.Text -> Double -> Double -> IO () +payXeroInvoice pipe dbName inv address amt zec = do token <- access pipe master dbName $ findToken address let aToken = t_access <$> (token >>= cast' . Doc) let aCode = t_code <$> (token >>= cast' . Doc) @@ -426,7 +427,8 @@ payXeroInvoice pipe dbName inv address amt = do [ "Invoice" .= object ["InvoiceNumber" .= inv] , "Account" .= object ["Code" .= fromMaybe "" aCode] , "Date" .= utctDay today - , "Reference" .= ("Paid in Zcash through ZGo" :: String) + , "Reference" .= + ("Paid in Zcash through ZGo: " ++ show zec ++ " ZEC" :: String) , "Amount" .= amt ]) $ addRequestHeader "Accept" "application/json" $ diff --git a/src/ZGoBackend.hs b/src/ZGoBackend.hs index ca4a7f4..5f73786 100644 --- a/src/ZGoBackend.hs +++ b/src/ZGoBackend.hs @@ -1192,6 +1192,7 @@ scanPayments config pipe = do (qexternalInvoice xO) (qaddress xO) (qtotal xO) + (qtotalZec xO) "WC" -> do let wOwner = fst $ head sResult ! 2 wooT <- diff --git a/zgo-backend.cabal b/zgo-backend.cabal index c797e56..24e686c 100644 --- a/zgo-backend.cabal +++ b/zgo-backend.cabal @@ -5,7 +5,7 @@ cabal-version: 1.12 -- see: https://github.com/sol/hpack name: zgo-backend -version: 1.2.5 +version: 1.2.6 synopsis: Haskell Back-end for the ZGo point-of-sale application description: Please see the README at category: Web