Skip to content

Conversation

@mahmoudhaney
Copy link

No description provided.

@mahmoudhaney
Copy link
Author

General Comments

  • The file structure is not correct, all install, uninstall, utils, validations, and realtime_events are not in the right path.
  • I should have one directory called utils and under it, I should have the:
    • install
    • uninstall
    • validations
  • utils should be separated by each entity, and each entity should have its own utility file.
  • File realtime_events should be under a directory called events, and create a new file for each event.

defendicon referenced this pull request in defendicon/pos_next Dec 9, 2025
- Consolidate all refactoring from PR #43 (modularization, validation splitting).
- Update copyright to 2025 across all touched files.
- Restore deleted keys in Branding API (`_c`, `_s`) and Credit Sales API (`net_balance`, `total_outstanding`) for frontend compatibility.
- Restore `cancel_credit_journal_entries` logic to maintain data integrity.
- Add backward compatibility shims for API endpoints.
- Document complex logic with comprehensive docstrings.
- Fix regression in branding auto-enable logic.
- Ensure all new files have proper copyright headers.
- Update `hooks.py` to reflect new file structure.
defendicon referenced this pull request in defendicon/pos_next Dec 9, 2025
* refactor: restructure utils and events as per review

Moves install.py, uninstall.py, validations.py to pos_next/utils/.
Splits realtime_events.py into pos_next/events/{stock,invoice,pos_profile}.py.
Refactors utils.py into pos_next/utils/version.py and adds package init.
Updates hooks.py to reflect new paths.

* refactor: apply PR review suggestions for security and structure

- Move API methods to `pos_next/api/` (branding, credit sales).
- Split monolithic validation methods in BrainWiseBranding, POSClosingShift, POSCoupon, ReferralCode.
- Implement secure signature verification in Branding (recalculate HMAC).
- Move hardcoded branding secrets to `pos_next/config/security.py`.
- Optimize database queries (replace loops with `get_all`, use atomic updates).
- Maintain backward compatibility for API endpoints and return structures.
- Restore `get_csrf_token` utility.
- Fix regression in `credit_sales.py` to restore original API contract.
- Fix regression in `branding.py` to respect disabled state.
- Fix regression in `referral_code.py` to restore duplicate check.

* refactor: add comments and docstrings for better maintainability

- Add detailed docstrings to BrainWiseBranding, POSClosingShift, POSCoupon, ReferralCode.
- Explain security mechanisms (HMAC, Master Key) in branding.
- Document atomic update logic in POSCoupon.
- Explain reconciliation logic in POSClosingShift.
- Document API endpoints in credit_sales and branding.

* refactor: finalize POS Next backend cleanup and security hardening

- Consolidate all refactoring from PR #43 (modularization, validation splitting).
- Update copyright to 2025 across all touched files.
- Restore deleted keys in Branding API (`_c`, `_s`) and Credit Sales API (`net_balance`, `total_outstanding`) for frontend compatibility.
- Restore `cancel_credit_journal_entries` logic to maintain data integrity.
- Add backward compatibility shims for API endpoints.
- Document complex logic with comprehensive docstrings.
- Fix regression in branding auto-enable logic.
- Ensure all new files have proper copyright headers.
- Update `hooks.py` to reflect new file structure.
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