Skip to content

feat(pipelinq): build pos-refund-limit - #3739

Open
rubenvdlinde wants to merge 7 commits into
developmentfrom
quality/build-pos-refund-limit
Open

rubenvdlinde wants to merge 7 commits into
developmentfrom
quality/build-pos-refund-limit

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Builds openspec/changes/pos-refund-limit (REQ-PLG-007): a refund at or below a configurable limit needs no manager.

Tasks done

  • 1.1 New setting pos.refund_limit (euros, empty by default) in SettingsService's tunables, edited in a "Refunds" section on the POS tab of the admin settings (adminSections.json, CnSettingsFieldsSection). A comma or a dot is accepted; empty, non-numeric or negative means no limit.
  • 1.2 PosRefundManagerGuard: a manager or admin is handled exactly as before. A non-manager may now complete a refund when a limit is set, the refund's gross (amount + tax, as recomputed server side) is at or below it, the original transaction exists and PosAccessPolicy::canAccessTransaction() admits them (own cashier, POS group or admin); the over-refund cap then applies as it does for a manager. Above the limit the till user gets "Een retour boven €X moet een beheerder verwerken."; with no limit the old message and behaviour stay. reject stays manager-only (the change does not ask to open it).
  • Schema (pipelinq_register.json, posRefund complete): the static authorization: ["pos_managers"] list is removed and the description says the guard decides. OpenRegister enforces that list before the guard runs, so with it in place a till user could never reach the limit rule. Managers are still checked by the guard (configured manager group or admin), so nobody who could not complete a refund before can now complete one above the limit. reject keeps its list.
  • 1.3 The refund screen's "After saving" card says who confirms: a manager (no limit), "you can confirm it yourself" (at or below the limit) or a manager (above it), from the settings' limit through a small src/services/posRefundLimit.js. The server guard remains the authority.
  • 1.4 Guard tests: below, at and above the limit (manager still completes above it), no usable limit (empty, blank, text, negative), reject stays a manager's, no access to the transaction, missing or unknown transaction, and the over-refund cap still enforced below the limit.

Tasks left, and why

  • 2.1: @spec tags are on the new methods and tests; the e2e test per scenario needs a live till and is not written here.
  • 2.2: belongs to archiving the change.

Tests added

  • tests/Unit/Lifecycle/PosRefundManagerGuardTest.php +8 (18 in the file). A deliberately broken limit comparison made one fail.
  • tests/vitest/posRefundLimit.spec.js (5), tests/vitest/posRefundBoardLook.spec.js +1 (the card's sentence for no limit, below and above), tests/vitest/adminSections.spec.js registers the new section.

Checks

php -l, phpcs and phpstan clean on the touched PHP; eslint clean on the touched JS/Vue; test:l10n passes, en/nl strings added and the JS catalogues rebuilt. PHP unit suite before: 6784 tests, 1 failure; after: 6792 tests, the same 1 failure (CrmPrivilegeRefusalGoldenTest TicketWooRequestController, inherited from development). Vitest before: 4327 passed; after: 4334 passed.


Generated by Claude Code

Assisted-by: ClaudeCode:claude-opus-5-5
claude and others added 6 commits November 13, 2026 11:43
… keys [skip ci]

Both this branch and another open branch appended keys at the end of the
catalogues, so the two conflicted whenever merged together. The six keys now
sit after "Refund amount"; no value changes.

Assisted-by: ClaudeCode:claude-opus-5-5
…rule [skip ci]

The complete transition lost its pos_managers authorization in favour of
PosRefundManagerGuard, but the schema version stayed 1.0.0, so an
upgraded instance's import would skip the schema and keep refusing every
till user. The access change itself is the owner's decision 390 that
the change cites.

Assisted-by: ClaudeCode:claude-opus-5-5
# Conflicts:
#	src/views/settings/adminSections.json
#	tests/vitest/adminSections.spec.js
…he refund screen

PosRefundManagerGuard read the limit through Application::APP_ID, which
this file no longer imports after development moved the constant, so the
guard would have failed with an unknown class. The refund limit helpers
and the refund screen's new methods carry their @SPEC, and the guard's
tests name their arguments.

Assisted-by: ClaudeCode:claude-opus-5-5
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/pipelinq @ 9d098b5

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ❌
psalm ❌
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
check-manifest ✅
check-vue-demi ✅
test-l10n ✅
format ❌
check-schema-l10n ❌
check-l10n-js ✅
check-e2e-nav ✅
check-lib-link ✅
composer ✅ ✅ 109/109
npm ✅ ✅ 646/646
app:check-code ⏭️
info.xml ✅
REUSE ❌
lockfile sync ✅
PHPUnit ❌
Newman ❌
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ❌

Quality workflow — 2026-11-20 04:39 UTC

Download the full PDF report from the workflow artifacts.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants