-
Notifications
You must be signed in to change notification settings - Fork 8
Backend: ehnc - Einvoice auth and generation logs #1228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,18 +21,27 @@ authenticateEInvoice :: | |||||||||||||||||||||||
| ) => | ||||||||||||||||||||||||
| GSTEInvoiceConfig -> | ||||||||||||||||||||||||
| m EInvoiceAuthResp | ||||||||||||||||||||||||
| authenticateEInvoice serviceConfig = case serviceConfig of | ||||||||||||||||||||||||
| CharteredInfoEInvoiceConfig cfg -> CharteredInfo.authenticate cfg | ||||||||||||||||||||||||
| authenticateEInvoice serviceConfig = do | ||||||||||||||||||||||||
| logInfo $ "GSTEInvoice.authenticateEInvoice: calling GSP with config=" <> show serviceConfig | ||||||||||||||||||||||||
| resp <- case serviceConfig of | ||||||||||||||||||||||||
| CharteredInfoEInvoiceConfig cfg -> CharteredInfo.authenticate cfg | ||||||||||||||||||||||||
| logInfo $ "GSTEInvoice.authenticateEInvoice: received response=" <> show resp | ||||||||||||||||||||||||
| pure resp | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| -- | Generate an e-invoice IRN via the configured GSP. | ||||||||||||||||||||||||
| generateEInvoice :: | ||||||||||||||||||||||||
| ( EncFlow m r, | ||||||||||||||||||||||||
| CoreMetrics m, | ||||||||||||||||||||||||
| HasRequestId r | ||||||||||||||||||||||||
| HasRequestId r, | ||||||||||||||||||||||||
| MonadFlow m | ||||||||||||||||||||||||
| ) => | ||||||||||||||||||||||||
| GSTEInvoiceConfig -> | ||||||||||||||||||||||||
| Text -> | ||||||||||||||||||||||||
| CITypes.EInvoicePayload -> | ||||||||||||||||||||||||
| m EInvoiceGenerateResp | ||||||||||||||||||||||||
| generateEInvoice serviceConfig authToken payload = case serviceConfig of | ||||||||||||||||||||||||
| CharteredInfoEInvoiceConfig cfg -> CharteredInfo.generateInvoice cfg authToken payload | ||||||||||||||||||||||||
| generateEInvoice serviceConfig authToken payload = do | ||||||||||||||||||||||||
| logInfo $ "GSTEInvoice.generateEInvoice: calling GSP with payload=" <> show payload | ||||||||||||||||||||||||
| resp <- case serviceConfig of | ||||||||||||||||||||||||
| CharteredInfoEInvoiceConfig cfg -> CharteredInfo.generateInvoice cfg authToken payload | ||||||||||||||||||||||||
| logInfo $ "GSTEInvoice.generateEInvoice: received response=" <> show resp | ||||||||||||||||||||||||
|
Comment on lines
+42
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not log full e-invoice payloads or generation responses.
🔒 Proposed safe logging shape generateEInvoice serviceConfig authToken payload = do
- logInfo $ "GSTEInvoice.generateEInvoice: calling GSP with payload=" <> show payload
+ logInfo "GSTEInvoice.generateEInvoice: calling GSP"
resp <- case serviceConfig of
CharteredInfoEInvoiceConfig cfg -> CharteredInfo.generateInvoice cfg authToken payload
- logInfo $ "GSTEInvoice.generateEInvoice: received response=" <> show resp
+ logInfo "GSTEInvoice.generateEInvoice: received response"
pure resp📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| pure resp | ||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid logging full auth config and auth response.
show serviceConfigandshow respcan persist credentials, GST identifiers, or auth tokens/session data in application logs. Prefer lifecycle logs with safe metadata only, or add explicit redacted renderers.🔒 Proposed safe logging shape
📝 Committable suggestion
🤖 Prompt for AI Agents