Skip to content

Commit

Permalink
backend/test: adds logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypalmudaliyar24 committed Sep 17, 2024
1 parent 21e5311 commit fadbc3e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/gateway/src/Product/ProviderRegistry.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ module Product.ProviderRegistry
)
where

import qualified Data.Text as T
import qualified "mock-registry" Domain.Lookup as Registry
import EulerHS.Prelude
import qualified EulerHS.Types as T
import Kernel.Types.Error
import Kernel.Utils.Common
import Kernel.Utils.GenericPretty (prettyShowViaJSON)
import Tools.Metrics
import qualified Types.Beckn.Context as B

Expand Down Expand Up @@ -51,5 +53,6 @@ registryFetch ::
Registry.LookupRequest ->
m Registry.LookupResponse
registryFetch registryUrl request = do
logDebug $ "Registry Lookup Request: " <> T.pack (prettyShowViaJSON request)
callAPI registryUrl (T.client Registry.lookupAPI request) "lookup" Registry.lookupAPI
>>= fromEitherM (ExternalAPICallError (Just "REGISTRY_CALL_ERROR") registryUrl)
1 change: 1 addition & 0 deletions app/gateway/src/Product/Search.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ search mbSignPayloadHeader mbBodyHashHeader rawReq = withFlowHandlerBecknAPI' do
domain = req.context.domain
subscriberType = Subscriber.BAP
logDebug $ "SubscriberType: " <> show subscriberType <> "; domain: " <> show domain
logDebug $ "JAYPAL: " <> show req
-- FIXME merchantId not required for gateway
authCheck headerNameStr (getRawHeader <$> mbSignPayloadHeader) (getRawHeader <$> mbBodyHashHeader) "merchantId" subscriberType domain
providers <- BP.lookup context
Expand Down
8 changes: 7 additions & 1 deletion app/mock-registry/src/Flow/Lookup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,23 @@
module Flow.Lookup where

import App.Types (FlowHandler)
import qualified Data.Text as T
import Domain.Lookup (LookupRequest, LookupResponse)
import Domain.Subscriber
import Kernel.Prelude
import Kernel.Storage.Esqueleto
import Kernel.Types.Beckn.Ack
import Kernel.Utils.Common (logDebug)
import Kernel.Utils.Error (withFlowHandlerAPI')
import Kernel.Utils.GenericPretty (prettyShowViaJSON)
import Storage.Queries.Subscriber as Sub

lookup :: LookupRequest -> FlowHandler LookupResponse
lookup req = withFlowHandlerAPI' $ do
findAllBy req.unique_key_id req.subscriber_id req.domain req._type req.city
logDebug $ "Lookup request: " <> T.pack (prettyShowViaJSON req)
res <- findAllBy req.unique_key_id req.subscriber_id req.domain req._type req.city
logDebug $ "Lookup response: " <> T.pack (prettyShowViaJSON res)
return res

create :: Subscriber -> FlowHandler AckResponse
create sub = withFlowHandlerAPI' $ do
Expand Down

0 comments on commit fadbc3e

Please sign in to comment.