bank transfer and wallet - payment option added.#4540#4547
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds two new payment types, ChangesBank Transfer and Wallet Payment Types
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/Models/Sale.php`:
- Around line 280-286: The accesses to $filters['only_bank_transfer'] and
$filters['only_wallet'] are not guarded and cause undefined-index warnings;
either add these keys with boolean defaults to the controller's filter
initialization in app/Controllers/Sales.php::getSearch() alongside other
defaults (e.g., only_cash, only_due, only_check) or change the checks in the
model (app/Models/Sale.php) to guard the array access using
!empty($filters['only_bank_transfer']) and !empty($filters['only_wallet']) (also
update the other two occurrences around lines 1521 and 1525) so the code only
reads those keys when present.
🪄 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: 6b7c3f46-6c0b-4198-a8ec-54b5942c2ff8
📒 Files selected for processing (10)
app/Controllers/Reports.phpapp/Controllers/Sales.phpapp/Helpers/locale_helper.phpapp/Language/en-GB/Sales.phpapp/Language/en/Sales.phpapp/Language/es-ES/Sales.phpapp/Language/es-MX/Sales.phpapp/Language/fr/Sales.phpapp/Models/Receiving.phpapp/Models/Sale.php
|
@bhojkamal As I understand it, this change is just adding the dropdown options for these payment types and not actually implementing the payment types themselves. There is a flaw in our implementation of the payment types in that they are being stored in the table as the string representation of whatever language the logged in employee was using at time of sale. We ought to have instead created a static table containing an id and name of the payment type then linked them using a foreign key and the payment method id is what gets stored in the table so you don't have inconsistent data. Good: We leave your implementation as is and @CodeRabbit creates an issue describing the need I've just explained. I'll leave it up to you what you want to do but the issue I brought up needs to be addressed at some point. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain
🏁 Script executed: Length of output: 59
Here's a summary of what was captured in the issue:
The issue also links back to this PR ( |
|
Also, I think the change as you have it is a core code change but likely implementing those payment methods (stripe, QR code, etc) we might want to do as a plugin rather than core code, since those plugins may require PCI Compliance work that I don't really want to deal with but plugin authors can manage if they want to develop them. @jekkos, what do you think? |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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`:
- Around line 95-98: The Sales UI uses language keys Sales.bank_transfer and
Sales.wallet but those keys are missing from many language files; open every
Sales.php language file and add entries for 'bank_transfer' and 'wallet' to the
returned translations array (using proper localized text or a sensible fallback
like English), ensuring the same key names used in the controller
('only_bank_transfer' => lang('Sales.bank_transfer') and 'only_wallet' =>
lang('Sales.wallet')) resolve everywhere; verify array syntax and run a quick
load of the app to confirm no untranslated key strings appear.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| 'only_debit' => lang('Sales.debit'), | ||
| 'only_bank_transfer' => lang('Sales.bank_transfer'), | ||
| 'only_wallet' => lang('Sales.wallet'), | ||
| 'only_invoices' => lang('Sales.invoice_filter'), |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify that Sales.bank_transfer and Sales.wallet language keys exist in all Sales language files
echo "Checking for 'bank_transfer' key in Sales language files:"
rg -n "['\"](bank_transfer)['\"]" --type=php -g 'app/Language/*/Sales.php'
echo -e "\nChecking for 'wallet' key in Sales language files:"
rg -n "['\"](wallet)['\"]" --type=php -g 'app/Language/*/Sales.php'
echo -e "\nLanguage files that should contain these keys:"
fd -t f 'Sales.php' app/Language/Repository: opensourcepos/opensourcepos
Length of output: 2349
Add language translations for bank_transfer and wallet keys to all language files.
The new filter options reference language keys Sales.bank_transfer and Sales.wallet, but these are only defined in 5 language files (en, en-GB, es-ES, es-MX, fr). They are missing from 39 other supported language files. This will cause the UI to display untranslated language key names instead of actual translations for the vast majority of users. Add these keys to all remaining language files in app/Language/*/Sales.php to prevent broken UI display.
🤖 Prompt for 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.
In `@app/Controllers/Sales.php` around lines 95 - 98, The Sales UI uses language
keys Sales.bank_transfer and Sales.wallet but those keys are missing from many
language files; open every Sales.php language file and add entries for
'bank_transfer' and 'wallet' to the returned translations array (using proper
localized text or a sensible fallback like English), ensuring the same key names
used in the controller ('only_bank_transfer' => lang('Sales.bank_transfer') and
'only_wallet' => lang('Sales.wallet')) resolve everywhere; verify array syntax
and run a quick load of the app to confirm no untranslated key strings appear.
|
@objecttothis The missing initialization is fixed too. The snapshot is below.
I think, it can be merge now. |
For the purpose of this PR, this is good enough, but it doesn't resolve the issue I raised in #4548. For example, if you log in as another employee with a different language enabled (that has translations for those phrases) and complete a sale, the transaction history report will show different languages. It was probably done this way before because originally we didn't have per-employee language selection and the flaw only becomes apparent in situations where more than one language is being used. In our use case there are three languages used by our employees, so it becomes obvious quickly. All that said, we can resolve #4548 in another PR. I'll do a code review right now. |
objecttothis
left a comment
There was a problem hiding this comment.
Just these two changes. Otherwise looks good.
objecttothis
left a comment
There was a problem hiding this comment.
Approved. Let me know if you can't squash and merge.


[Feature]: Add support for additional payment types in Sales (Bank Transfer (QR), Wallet) #4540
Summary by CodeRabbit