review of the brainwise_branding.py file#43
Open
mahmoudhaney wants to merge 4 commits intodevelopfrom
Open
Conversation
Contributor
Author
General Comments
|
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.
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.
No description provided.