Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,17 @@ generateDomainHandlerDashboard (DefaultImports qualifiedImp simpleImp _packageIm
storeTransactionImports :: [String]
storeTransactionImports =
when_
(any (\apiT -> apiT ^. apiType /= GET) $ input ^. apis)
[ "Domain.Types.Transaction"
( any
( \apiT ->
case (apiT ^. authType, apiT ^. apiType) of
(Just ApiAuthV2 {}, _) -> True
(Just ApiAuthV3 {}, _) -> True
_ -> False

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be simplified, lines 103-104 are redundant

                case (apiT ^. authType, apiT ^. apiType) of
                  (Just ApiAuthV2 {}, _) -> True
                  (Just ApiAuthV3 {}, _) -> True
                  _ -> False

)
(input ^. apis)
)
[ "Domain.Types.Transaction",
"SharedLogic.Transaction"
]

ifValidationRequired :: Bool
Expand Down Expand Up @@ -162,10 +171,18 @@ handlerFunctionDef serverName clientFuncName apiT = do
if useAuth
then vP "checkedMerchantId" <-- vE "merchantCityAccessCheck" ~* vE "merchantShortId" ~* vE "apiTokenInfo.merchant.shortId" ~* vE "opCity" ~* vE "apiTokenInfo.city"
else letStmt "checkedMerchantId" $ vE "skipMerchantCityAccessCheck" ~* vE "merchantShortId"
let transactionWrapper clientCall = case apiT ^. apiType of
GET -> clientCall
_ | not useAuth -> clientCall
_ -> do
let transactionWrapper clientCall = case (apiT ^. apiType, useAuth) of
(GET, True) -> do
TH.noBindSW $
vE "SharedLogic.Transaction.withGetTransactionStoring"
~* (vE "Domain.Types.Transaction.castEndpoint" ~* vE "apiTokenInfo.userActionType")
~* (cE "Kernel.Prelude.Just" ~* cE serverName)
~* (cE "Kernel.Prelude.Just" ~* vE "apiTokenInfo")
~* cE "Kernel.Prelude.Nothing"
~* cE "Kernel.Prelude.Nothing"
~$ TH.doEW clientCall
(_, False) -> clientCall

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this case is redundant (GET, False) -> clientCall

(_, True) -> do
vP "transaction"
<-- vE "SharedLogic.Transaction.buildTransaction"
~* (vE "Domain.Types.Transaction.castEndpoint" ~* vE "apiTokenInfo.userActionType")
Expand Down