Repository navigation
Feature: Payment reference code - #4587
Merged
Merged
Conversation
added 5 commits
June 29, 2026 15:24
Signed-off-by: Travis Garrison <[email protected]>
…nd replace snake_case with camelCase variables Signed-off-by: Travis Garrison <[email protected]>
…ys like `must_enter_rrn` and `reference_code` Signed-off-by: Travis Garrison <[email protected]>
…ment` with `referenceCode` support Signed-off-by: Travis Garrison <[email protected]>
…e naming conventions and improve readability Signed-off-by: Travis Garrison <[email protected]>
This comment was marked as low quality.
This comment was marked as low quality.
added 4 commits
June 29, 2026 18:28
…erence_code` across language files and update `Sales` controller to replace `must_enter_rrn` with the new key Signed-off-by: Travis Garrison <[email protected]>
- Add `get_reference_code_payment_types()` to locale_helper as single source of truth for card-requiring payment types - Add reference code row to register view, shown/hidden via JS based on selected payment type - Fix payment type dropdown width to 100% for consistent layout - Add min-width to payment buttons and right-padding to button group Signed-off-by: Travis Garrison <[email protected]>
- Add payment_reference_code_min and payment_reference_code_max fields to Config controller save logic - Add translation keys for reference code length limits across all language files (min/max label + section header) - Align array key formatting in Config controller for readability Signed-off-by: Travis Garrison <[email protected]>
…language files Convert double-quoted array keys and values to single quotes in all app/Language/*/Config.php and app/Language/*/Sales.php variants. No translation content changed — formatting only. Also add Localization section to AGENTS.md documenting language file conventions for new keys and fallback behavior. Signed-off-by: Travis Garrison <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
added 2 commits
July 2, 2026 01:21
Add localized strings for payment_reference_code_length_limits, payment_reference_code_length_max_label, and payment_reference_code_length_min_label across all supported locales. Signed-off-by: Travis Garrison <[email protected]>
- Add baseLocalePayload() helper in ConfigTest for postSaveLocale tests - Add testSaveLocale_AcceptsValidReferenceCodeMinMax and related boundary tests - Add Sale_libPaymentTest for payment reference code validation in Sale_lib Signed-off-by: Travis Garrison <[email protected]>
objecttothis
marked this pull request as ready for review
July 1, 2026 21:37
Contributor
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/Controllers/Sales.php`:
- Line 1394: The sale edit save flow is dropping reference codes because
postSave() does not carry reference_code through when rebuilding payment rows.
Update the Sales controller’s postSave() handling so edited and newly added
payments persist reference_code the same way postAddPayment() does, including
validation and assignment into the payment data structures before saving.
- Around line 489-492: The payment handling in Sales::addPayment is passing raw
reference_code for every tender type and the Sale_lib::addPayment aggregation is
collapsing distinct card references under the same payment_type. Update the
addPayment flow and its session keying/contract so only reference-code payment
types carry a sanitized validated reference_code, and distinct Credit/Debit
reference codes are preserved while non-reference tender types ignore stray
codes without changing the stored payment_type.
- Around line 405-407: The payment validation rules in Sales::... currently only
require amount_tendered, which lets non-numeric input reach parse_decimals() and
downstream totals. Update the rules array for the card/reference-code payment
flow to include the normal decimal/numeric validation for amount_tendered while
keeping the existing required checks, and make sure the sanitization/validation
path used in this controller still enforces numeric input before calling
parse_decimals().
In `@app/Language/ar-EG/Config.php`:
- Around line 229-232: The translation entry in Config.php for
payment_reference_code_length_limits uses a malformed line-break tag, so update
that label to use the proper br tag instead of the closing form. Make the change
in the Config array entry for payment_reference_code_length_limits, keeping the
rest of the Arabic text unchanged, and ensure the label renders with the
intended break.
In `@app/Language/ar-LB/Config.php`:
- Around line 229-232: The translation entry for
payment_reference_code_length_limits uses a malformed HTML break tag, so update
the string in Config.php to use a proper br tag format instead of the
closing-only form. Make this change in the language array alongside
payment_reference_code_length_max_label and
payment_reference_code_length_min_label, keeping the rest of the translation
text unchanged.
In `@app/Language/az/Config.php`:
- Around line 229-232: Fix the malformed HTML in the language string for
payment_reference_code_length_limits in Config::az so the label uses a proper
line break tag. Replace the closing-only break markup with the standard <br> tag
in that translation entry, and keep the adjacent
payment_reference_code_length_max_label and
payment_reference_code_length_min_label entries unchanged.
In `@app/Language/bg/Config.php`:
- Around line 229-232: The translation string in Config.php for
payment_reference_code_length_limits uses a malformed closing break tag, so
update that label to use the correct HTML break syntax instead of the current
closing form; keep the change limited to the
payment_reference_code_length_limits entry alongside the related
payment_reference_code_length_max_label and
payment_reference_code_length_min_label strings.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ed0a4eea-4d24-42ad-a8d9-7ce7a874a642
📒 Files selected for processing (101)
AGENTS.mdapp/Controllers/Config.phpapp/Controllers/Sales.phpapp/Helpers/locale_helper.phpapp/Language/ar-EG/Config.phpapp/Language/ar-EG/Sales.phpapp/Language/ar-LB/Config.phpapp/Language/ar-LB/Sales.phpapp/Language/az/Config.phpapp/Language/az/Sales.phpapp/Language/bg/Config.phpapp/Language/bg/Sales.phpapp/Language/bs/Config.phpapp/Language/bs/Sales.phpapp/Language/ckb/Config.phpapp/Language/ckb/Sales.phpapp/Language/cs/Config.phpapp/Language/cs/Sales.phpapp/Language/da/Config.phpapp/Language/da/Sales.phpapp/Language/de-CH/Config.phpapp/Language/de-CH/Sales.phpapp/Language/de-DE/Config.phpapp/Language/de-DE/Sales.phpapp/Language/el/Config.phpapp/Language/el/Sales.phpapp/Language/en-GB/Config.phpapp/Language/en-GB/Sales.phpapp/Language/en/Config.phpapp/Language/en/Sales.phpapp/Language/es-ES/Config.phpapp/Language/es-ES/Sales.phpapp/Language/es-MX/Config.phpapp/Language/es-MX/Sales.phpapp/Language/fa/Config.phpapp/Language/fa/Sales.phpapp/Language/fr/Config.phpapp/Language/fr/Sales.phpapp/Language/he/Config.phpapp/Language/he/Sales.phpapp/Language/hr-HR/Config.phpapp/Language/hr-HR/Sales.phpapp/Language/hu/Config.phpapp/Language/hu/Sales.phpapp/Language/hy/Config.phpapp/Language/hy/Sales.phpapp/Language/id/Config.phpapp/Language/id/Sales.phpapp/Language/it/Config.phpapp/Language/it/Sales.phpapp/Language/km/Config.phpapp/Language/km/Sales.phpapp/Language/lo/Config.phpapp/Language/lo/Sales.phpapp/Language/ml/Config.phpapp/Language/ml/Sales.phpapp/Language/nb/Config.phpapp/Language/nb/Sales.phpapp/Language/nl-BE/Config.phpapp/Language/nl-BE/Sales.phpapp/Language/nl-NL/Config.phpapp/Language/nl-NL/Sales.phpapp/Language/pl/Config.phpapp/Language/pl/Sales.phpapp/Language/pt-BR/Config.phpapp/Language/pt-BR/Sales.phpapp/Language/ro/Config.phpapp/Language/ro/Sales.phpapp/Language/ru/Config.phpapp/Language/ru/Sales.phpapp/Language/sv/Config.phpapp/Language/sv/Sales.phpapp/Language/sw-KE/Config.phpapp/Language/sw-KE/Sales.phpapp/Language/sw-TZ/Config.phpapp/Language/sw-TZ/Sales.phpapp/Language/ta/Config.phpapp/Language/ta/Sales.phpapp/Language/th/Config.phpapp/Language/th/Sales.phpapp/Language/tl/Config.phpapp/Language/tl/Sales.phpapp/Language/tr/Config.phpapp/Language/tr/Sales.phpapp/Language/uk/Config.phpapp/Language/uk/Sales.phpapp/Language/ur/Config.phpapp/Language/ur/Sales.phpapp/Language/vi/Config.phpapp/Language/vi/Sales.phpapp/Language/zh-Hans/Config.phpapp/Language/zh-Hans/Sales.phpapp/Language/zh-Hant/Config.phpapp/Language/zh-Hant/Sales.phpapp/Libraries/Sale_lib.phpapp/Models/Sale.phpapp/Views/configs/locale_config.phpapp/Views/sales/register.phppublic/css/register.csstests/Controllers/ConfigTest.phptests/Libraries/Sale_libPaymentTest.php
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Gift card payments use amount_tendered as giftcard number (integer); cash/other payments require decimal_locale format. Apply correct validation rule per payment type instead of generic required. Signed-off-by: Travis Garrison <[email protected]>
added 4 commits
July 2, 2026 02:06
Signed-off-by: Travis Garrison <[email protected]>
Replace hardcoded precision 2 with totals_decimals() when comparing discount against item total via bccomp/bcmul, so discount validation respects the configured decimal precision setting. Signed-off-by: Travis Garrison <[email protected]>
Replace placeholder/mismatched strings with accurate translations: - email_mailpath, email_smtp_pass, invoice_email_message - number_locale_invalid/required, receipt_template - reward_configuration, right, tax_decimals, theme Signed-off-by: Travis Garrison <[email protected]>
- Add reference_code field to new payment row in sale edit form - Persist reference_code on insert in Sale model - Validate reference_code_new in Sales controller using configurable min/max length rules Signed-off-by: Travis Garrison <[email protected]>
Member
Author
|
@jekkos this PR is blocking a plugin. Any chance we can review it and get it into the master? It's a fairly minor feature. It should be fairly straightforward to review as there are only 11 changed files outside of the language files. |
Member
Author
|
@jekkos when do you think you'll be able to take a look at this PR? |
added 2 commits
July 7, 2026 10:45
Signed-off-by: Travis Garrison <[email protected]>
…ent-reference-code
jekkos
previously approved these changes
Jul 8, 2026
jekkos
left a comment
Member
There was a problem hiding this comment.
Not going to hold this back in case you think it's working, but I do have one minor style remark and a question.
This comment was marked as resolved.
This comment was marked as resolved.
…e field in the db Signed-off-by: Travis Garrison <[email protected]>
- Add validation of UI settings to prevent overridden values from being passed. - Correct maximum value in JS for payment_reference_code maximum length to 40. - Fix bug causing copy_entire_sale() to incorrectly copy the reference code and cash_adjustment Signed-off-by: Travis Garrison <[email protected]>
This was referenced Aug 7, 2026
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.
app/Database/Migrations/20190427100000_paymenttracking.php adds the reference_code column to the sales_payments table but this column was never used in the code itself. This is now needed for Credit Card Retrieval Reference Numbers (RRN), Transaction Number or Acquirer Reference Number (ARN) depending on the payment implementation. This number is manually entered when using a card payment system not integrated with OpensourcePOS and can be used by plugins when sending API data to government-required sales registers.
Summary by CodeRabbit
Payment Reference Code appears with Debit and Credit type payments

Customizable length limits

reference_code is now stored in the database

Validation on limits and content
