Commit Graph

168 Commits

Author SHA1 Message Date
Mayuresh A Nirhali
f774d09711 Merge pull request #640 from beckn/new-context
fix(reqpreprocessor): support camelCase context attributes (bapId, bppId, transactionId, messageId)
2026-03-25 20:27:47 +05:30
Mayuresh
c2e357fd1e reverting changes from schemav2validator plugin 2026-03-25 20:15:51 +05:30
Mayuresh A Nirhali
cc5d347a05 Merge pull request #639 from beckn/camelcase
fix(router): support camelCase context attributes (bppUri, bapUri) fo…
2026-03-25 19:36:08 +05:30
Mayuresh
72593d2ab6 fix(router): support camelCase context attributes (bppUri, bapUri) for beckn spec migration
Replace fixed JSON struct tags for bpp_uri and bap_uri with a map-based parse of
the context object. A new getContextString() helper checks the snake_case key first
and falls back to the camelCase key, so routing works transparently for both the
legacy beckn spec and the new camelCase convention.

Also adds a nil-context guard so a missing context field returns a clear error
instead of a panic.

Test coverage:
- Two new cases in TestRouteSuccess for bppUri and bapUri camelCase payloads
- TestGetContextString: 5 table-driven cases covering snake, camel, precedence,
  missing, and empty-snake-fallthrough scenarios
- TestRouteNilContext: confirms clear error on missing context field

Fixes #636

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 15:41:16 +05:30
Mayuresh
1be757a165 fix(reqpreprocessor): support camelCase context attributes for beckn spec migration
- Add transactionId and messageId as camelCase aliases in model.go contextKeys map,
  pointing to the same ContextKeyTxnID and ContextKeyMsgID constants. This allows
  adapter configs to reference either form without failing startup validation.

- In reqpreprocessor, add firstNonNil() helper for subscriber/caller ID lookups
  so bap_id/bapId and bpp_id/bppId are both resolved correctly regardless of
  which beckn spec version the payload uses. snake_case takes precedence when both
  are present.

- Add snakeToCamel() helper used in the context key loop so a single config entry
  (e.g. transaction_id) automatically also checks the camelCase form (transactionId)
  without requiring any config file changes.

- Add TestSnakeToCamel, TestCamelCaseSubscriberID, TestCamelCaseContextKeys to
  cover all new code paths.

Fixes #637

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 15:40:36 +05:30
Ritesh
97e63cf7d2 fix: remove unsupported map fallback in policy result parsing 2026-03-25 14:47:04 +05:30
Ritesh
13a7a18e17 Fix: address policy checker review feedback 2026-03-24 17:59:48 +05:30
Ayush Rawat
80e7b299f1 Refactor Policy Enforcer to Policy Checker
- Renamed the `PolicyEnforcer` interface and related implementations to `PolicyChecker` for clarity and consistency.
- Updated configuration keys in YAML files to reflect the new `checkPolicy` terminology.
- Adjusted related code, tests, and documentation to support the new naming convention and ensure compatibility.
- Enhanced comments and examples for the `checkPolicy` configuration to improve usability.
2026-03-23 04:08:13 +05:30
Ayush Rawat
ff4d909b7e Enhance Policy Enforcer Configuration and Add Benchmark Tests
- Added detailed comments and examples for the `policyPaths` configuration in both BAP and BPP YAML files to improve clarity on usage.
- Introduced a new benchmark test suite for the Policy Enforcer to evaluate performance under varying rule counts, measuring both evaluation and compilation times.
2026-03-05 15:31:34 +05:30
Ayush Rawat
dfbaf5c6c5 Refactor Policy Enforcer to Use Unified PolicyPaths
- Updated the Policy Enforcer to consolidate policy source configuration under a single `policyPaths` key, allowing for auto-detection of URLs, directories, and files.
- Removed deprecated keys such as `policyFile` and `policyUrls` from the configuration structure.
- Adjusted related code and tests to ensure compatibility with the new configuration format.
- Enhanced documentation to clarify the usage of `policyPaths` and provide examples for various configurations.
2026-03-03 18:49:17 +05:30
Ayush Rawat
a806af3228 Update Policy Enforcer Configuration Keys
- Changed configuration key from `policyDir` to `policyPaths` across multiple YAML files and related code to standardize the naming convention.
- Updated documentation to reflect the new key name and its usage for specifying local directories containing `.rego` policy files.
- Adjusted tests to ensure compatibility with the updated configuration structure.
2026-03-03 15:02:04 +05:30
Ayush Rawat
e22b79e137 Refactor Policy Enforcer Configuration
- Updated the Policy Enforcer configuration across multiple YAML files to use a unified `policyDir` instead of individual policy sources.
- Changed the step name from `enforcePolicy` to `policyEnforcer` for consistency.
- Enhanced the documentation to clarify the use of `policyUrls`, `policyDir`, and `policyFile` for policy sources.
- Adjusted related code and tests to accommodate the new configuration structure.
- Added documentation for using YAML folded scalar (>-) to keep long comma-separated policyUrls values readable across multiple lines.
2026-03-03 10:04:22 +05:30
Ayush Rawat
3617c9b4a6 Implement Policy Enforcer Plugin
- Added a new Policy Enforcer plugin to evaluate incoming messages against OPA policies.
- Configurable via YAML with options for policy sources, actions, and query.
- Integrated into existing configuration files for BAP and BPP.
- Updated related tests and documentation for the new functionality.
- Enhanced plugin manager to support Policy Enforcer instantiation.
2026-03-02 20:09:33 +05:30
Mayuresh A Nirhali
fe541227b9 Merge pull request #614 from ssd532/fix/test-failures
Fix test failures in reqmapper and simplekeymanager plugins
2026-03-02 17:30:53 +05:30
Manendra Pal Singh
59aa058920 Feat: update the pr as per comment 2026-02-27 19:05:09 +05:30
Manendra Pal Singh
9d57d3b8f1 Feat : Update PR as comment 2026-02-26 14:45:35 +05:30
Sachin Divekar
34954ce83a Fix test failures in reqmapper and simplekeymanager plugins
- reqmapper/cmd: Add missing mappingsFile to TestProviderNewSuccess config
- simplekeymanager/cmd: Fix wantErr for partial config (keyId-only) case
- simplekeymanager/cmd: Use valid base64 key values in TestConfigMapping
- simplekeymanager: Remove incorrect SubscriberID assertion from TestGenerateKeyset
  (GenerateKeyset generates raw keys, subscriber identity is assigned separately)
2026-02-24 20:04:10 +05:30
Manendra Pal Singh
ab89102711 Feat: configure audit fields and metrics for onix adapter and add local configuration for onix adapterZ 2026-02-23 16:08:44 +05:30
Manendra Pal Singh
8948479dea Feat: Update the logger config to show the parent_id 2026-01-28 21:29:37 +05:30
Nirmal N R
c512633cbe chore: updated error message for allowedParentnamespaces validation 2026-01-21 14:57:21 +05:30
Nirmal N R
95e5c991a5 feat: add allowed parent namespaces for signature validation 2026-01-20 19:52:45 +05:30
Manendra Pal Singh
f860ff820c add the valdation 2026-01-12 16:44:29 +05:30
Manendra Pal Singh
58457d53c2 fix : add the tls support for the redis cache 2026-01-09 12:40:10 +05:30
Mayuresh A Nirhali
bbc7ff91f9 Merge pull request #568 from Beckn-One/feat/observability
Feat/observability
2025-12-18 15:27:47 +05:30
Manendra Pal Singh
176b8f3043 update the as per the comment 2025-12-18 12:30:28 +05:30
Manendra Pal Singh
17d9ca865d update the as per the comment 2025-12-15 12:12:33 +05:30
Manendra Pal Singh
89ebaf69e4 update and merged with latest master 2025-12-15 10:09:39 +05:30
ameersohel45
706030ccec test: add tests and update docs for extended schema validation 2025-12-14 23:55:04 +05:30
ameersohel45
3b59507f15 ref: improve error handling in extended schema validation 2025-12-14 23:07:58 +05:30
ameersohel45
cd49b7dda9 ref: enhance schema validation logic and skip core schema 2025-12-14 21:49:51 +05:30
ameersohel45
f0ccef9e59 fix: remove redundant code 2025-12-12 17:21:02 +05:30
ameersohel45
f6b32ef2f2 fix: error handling in extended schema 2025-12-12 17:21:02 +05:30
ameersohel45
5843d2a760 update: logs and comments also ref refreshLoop method 2025-12-12 17:21:02 +05:30
ameersohel45
5feb84196c ref: Split Extended Schema logic and rename variables 2025-12-12 17:21:02 +05:30
ameersohel45
5739573da0 ref: remove url transform config 2025-12-12 17:21:02 +05:30
ameersohel45
94943e63e6 Issue580-feat: add support for referenced schema validation and caching 2025-12-12 17:21:02 +05:30
Mayuresh Nirhali
96fac33be1 573 - New plugin - schema mapper 2025-12-05 16:09:02 +05:30
Manendra Pal Singh
045f29da13 update as per the PR comment 2025-12-02 23:00:28 +05:30
Manendra Pal Singh
8fd7afb54a update as per the PR comment 2025-12-02 21:14:02 +05:30
Manendra Pal Singh
4f2a137482 merged with latest main 2025-11-28 11:06:14 +05:30
Manendra Pal Singh
5e3170c859 update as per the comment in pr 2025-11-27 22:43:42 +05:30
ameersohel45
1efb6f5bb9 Issue 556 - add: Add retry configuration support to dediregistry plugin 2025-11-26 11:56:17 +05:30
ameersohel45
0ebe0f0551 updated: test-data file 2025-11-24 12:59:17 +05:30
ameersohel45
6e6b066b80 feat(router): Make domain field optional for Beckn Protocol v2.x.x 2025-11-24 12:48:23 +05:30
Manendra Pal Singh
88eef682df can create matric in there respective module. 2025-11-24 10:25:26 +05:30
Manendra Pal Singh
c38e7b75ca merged with latest master 2025-11-21 16:07:19 +05:30
Manendra Pal Singh
8ef4904076 make changes as per the doc 2025-11-21 16:01:59 +05:30
ameersohel45
ab31e13e81 Issue 554 - refactor: improve error response format 2025-11-18 14:52:37 +05:30
ameersohel45
f9fac45106 Issue 552 - fix: optimized code creating in memory map for action to schema. 2025-11-18 02:25:04 +05:30
ameersohel45
75880a4458 543 - update: to use updated config structure 2025-11-14 13:06:31 +05:30