Improve DOKU error reporting and add QRIS generation probe - #442
Merged
Conversation
…s status A failed qr-mpm-generate reported nothing but the HTTP status, because the non-2xx branch discarded the response body before anything parsed it. DOKU answers every rejection with a responseCode and responseMessage naming the cause, so "failed with status 500" hid the one detail needed to fix it. The rejection path now parses that body, falling back to the raw payload (truncated) when DOKU answers with something other than its own error shape, and carries it into both the log line and the returned error. The generate rejection message gains the responseCode alongside the message for the same reason. NewClient also trims a trailing slash off DOKU_BASE_URL: the signature is computed over the single-slash path while the request would go to a double-slash one, which the access token call survives (its signature does not cover the path) and every transactional call does not. `dokucheck generate` sends a real qr-mpm-generate and prints DOKU's reply, so the endpoint can be exercised without going through checkout. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PRC2MG3QCca6Qa7sevUPxi
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enhanced error handling and diagnostics for DOKU payment gateway integration by providing detailed failure messages and adding a QRIS generation probe to the credential verification tool.
Key Changes
dokucheck generate, helping diagnose merchant/terminal configuration issuesImplementation Details
describeFailure()function to parse DOKU error responses and format them consistently, with a 512-character limit to prevent log spamdoSignedRequest()to include failure details in both error messages and structured logsGenerateQris()error message to use the same formatting as HTTP-level failureshttps://claude.ai/code/session_01PRC2MG3QCca6Qa7sevUPxi