Feature #10442
openAdd module-level payment method switches (Ecom Order / Preorder / POS / Landscaping) to control checkout visibility
Added by Ajit A about 1 month ago. Updated 29 days ago.
Subtasks
Related issues
Updated by Ajit A about 1 month ago
- % Done changed from 0 to 40
1. Core Changes Implemented
A. Frontend (evergreen_pos_fe)
Payment Method Drawer UI (OperationsSettings.tsx & CompanyProfile.tsx):
Unified Credit/Debit Cards under a single Cards (Credit / Debit) accordion drawer.
Added an "AVAILABLE IN MODULES:" panel positioned at the top inside each payment method accordion drawer (POS Terminal, Bank Transfer, Zelle, Cards, Check, Cash).
Implemented E-Commerce as a parent card with collapsible, horizontal side-by-side Order (Emerald dot) and Preorder (Blue dot) child badge switches.
Updated the Cancel button to a clean outlined style (border-gray-300 bg-white hover:bg-gray-50).
POS Billing Integration (Header/index.tsx):
Filtered POS header payment selection dropdown so that methods are only shown when modules.pos !== false.
Landscaping Quotes & Invoices Integration (Invoice.tsx & InvoicePublicUrl.tsx):
Updated quote and job invoice payment resolvers (resolveInvoiceAllowedPaymentMethods and allowedPaymentMethods) to respect modules.landscaping !== false.
B. Backend (evergreen_pos_be)
Schema & Service Defaults (company-model.js & payment.service.js):
Added modules: { order: true, preorder: true, pos: true, landscaping: true } defaults per payment method.
Refactored getEnabledCompanyEcommercePaymentMethods to enforce per-method order and preorder module flags with fallback support for legacy database records.
Staff Login Fix (user-controller.js):
Resolved "Company database not found" error when logging in as a staff user on generic local domains (localhost). Added lightweight lean projection lookup (.select('_id dbName companyName slug status').lean()) across active databases and automated central user registry sync.
C. E-Commerce Application (evergreenpos_E-commerce_new)
Checkout Payment Filtering (ecommercePaymentMethods.ts & CheckoutPreorder.tsx):
Filtered checkout payment options by checking modules.order (for standard store orders) and modules.preorder (for preorder checkout).
2. Modified Files List
text
evergreen_pos_fe:
- M src/components/Header/index.tsx
- M src/pages/Invoice/Invoice.tsx
- M src/pages/Quotes/InvoicePublicUrl.tsx
- M src/pages/Settings/CompanyProfile/CompanyProfile.tsx
- M src/pages/Settings/CompanyProfile/EcommerceSettings.tsx
- M src/pages/Settings/CompanyProfile/OperationsSettings.tsx
evergreen_pos_be:
- M src/controllers/nursery/user-controller.js
- M src/models/Company/company-model.js
- M src/services/nursery/payment.service.js
evergreenpos_E-commerce_new:
- M src/features/checkout/pages/CheckoutPreorder.tsx
- M src/features/loyalty/components/LoyaltyCheckoutPanel.tsx
- M src/utils/ecommercePaymentMethods.ts
3. Testing & QA Status
API Persistence: Verified PATCH /company/update-company/:companyId correctly updates and persists all modules objects in MongoDB.
POS & Landscaping Verification: Verified in live DB inspection script and UI that disabling module switches hides payment options in targeted checkout areas.
Backwards Compatibility: Legacy tenant records without modules keys automatically default to true (fully enabled).
Status: Ready for QA / Review.
Updated by Ajit A 29 days ago
Landscaping Payment Filtering Fix (PaymentManagement.tsx, Invoice.tsx, InvoicePublicUrl.tsx):
Fixed empty array fallback in PaymentManagement so that when all/certain payment methods are disabled for Landscaping (allowedMethods = []), it does not revert to displaying all default 6 methods.
Updated InvoicePublicUrl.tsx to evaluate modules.landscaping !== false cleanly without byUser restrictions.
Updated Invoice.tsx to pass companyAllowedPaymentMethods directly to allowedMethods.
Dynamic Browser Tab Title (productHost.ts):
Updated productHostDocumentTitle to dynamically resolve active company branding (localStorage.getItem('companyName')), fixing the issue where browser tabs hardcoded "NexZenTek" instead of Evergreen Farms.