Repository navigation
Conversation
Every capability answered failures the same way, so a caller could not tell a bad request from an unknown record from a provider being down. Each failure now has its own code, HTTP status and plain message, in one NACK shape with details.path where a field is at fault. Codes come only from the Beckn enum and the four the adapter already used.
|
📊 Test Coverage: ✅ Passed — 86% of changed lines covered, min 80% |
🛡️ Trivy security scan (CRITICAL,HIGH,MEDIUM,LOW)Go dependencies
Container image
|
The constant sat between the payload doc comment and its type, so the comment no longer described the type below it.
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.
What
Every failure the adapter returns now has its own error code, HTTP status and plain message, in one NACK shape. When a request field is at fault,
details.pathpoints to it. Codes come only from the Beckn error enum and the four the adapter already used. No mapping files changed.context.senderId,receiverId,bppUrioractionSCH_INVALID_FORMAT, long sentenceCTX_MISSING_FIELD,context.<field> is missing, path$.context.<field>contextin the bodySCH_REQUIRED_FIELD_MISSING, no pathcontext is missing/context must be an object, path$.contextcontext.bppUriSCH_INVALID_FORMATCTX_INVALID_BPP_URISCH_INVALID_FORMATSCH_INVALID_JSONSCH_INVALID_FORMATSCH_ACTION_NOT_SUPPORTEDmessage/items/0/id$.message.items[0].idreqpreprocessor{"code","message"}bodydetails.pathBAD Request: ...,Endpoint not found: ...404 page not foundNET_ENTITY_NOT_FOUND,unknown endpoint: <path>NET_ENTITY_NOT_FOUNDNET_ENTITY_NOT_FOUNDNET_DOWNSTREAM_UNAVAILABLEBIZ_GENERIC_ERROR,<provider> rejected the requestNET_DOWNSTREAM_UNAVAILABLENET_ENTITY_NOT_FOUND,<provider> has no matching recordNET_DOWNSTREAM_UNAVAILABLE,<provider> rejected the adapter's credentialsNET_DOWNSTREAM_UNAVAILABLE, provider named, no URL or hostNET_DOWNSTREAM_UNAVAILABLE; past the 30s write timeout, connection closed with no answerNET_TIMEOUT, answered before the write timeoutSCH_SCHEMA_ADAPTATION_FAILEDNET_DOWNSTREAM_UNAVAILABLE,could not get a login token from <provider>NET_INTERNAL_ERROR,<provider> is not configured on this adapterNET_DOWNSTREAM_UNAVAILABLE,registry is unavailableErrors raised in the core handler keep the 1.x envelope for 1.x requests.
reqpreprocessorerrors and the unknown-path 404 always use the v2 envelope, because they answer before or without readingcontext.version.Why
Weather observation, mandi price, knowledge advisory, POCRA facilities and the PM-KISAN / PM-FBY scheme APIs all answered failures the same way. A caller could not tell a bad request from an unknown record from an upstream being down.
Testing
make test,gofmtandgo vetpass.Closes #108