Commit Graph
46 Commits
Author SHA1 Message Date
Jeppe Bundgaard 6a694f92cc Add bulk action preview and apply endpoints for collected invoices 2026-07-08 13:46:31 +02:00
Jeppe Bundgaard 62f2c80dda Scope monthly invoice split endpoint 2026-07-06 13:37:31 +02:00
Jeppe Bundgaard aca8be51dc Implement move collected invoice to customer functionality with API endpoint and associated tests 2026-06-09 13:12:55 +02:00
Jeppe B d6190626ce Merge pull request #262 from copenhagentruckwash/fix-cross-tenant-job-data-exposure
Scope economic transfer queue jobs by creator
2026-06-02 00:20:48 +02:00
Jeppe B ce8e6d0dab Scope economic transfer queue jobs by creator 2026-06-02 00:20:30 +02:00
Jeppe B f5c1a34c29 Merge pull request #256 from copenhagentruckwash/fix-idor-vulnerability-in-economic-v2-endpoints
Prevent IDOR on Economic V2 collected-invoice endpoints
2026-06-01 23:58:41 +02:00
Jeppe B 22ad96bc8e Fix economic v2 invoice endpoint authorization scope 2026-06-01 23:58:30 +02:00
Jeppe Bundgaard 6d4066be1c Add unit tests for InvoicingPeriodDraftOverlay and reference suggestion logic, including fake DB integration and aggregation methods
- Implemented `InvoicingPeriodDraftOverlayTest` with coverage for blocking and permitting invoicing actions based on draft states, transactions, and metadata.
- Created `ReferenceSuggestionsApiTest` to validate ranked and filtered suggestions across bookings, orders, and vehicles with varied match relevance, context, and frequency.
- Added `order_reference_suggestions_service` class, including query methods, normalization utilities, and aggregation logic for reference suggestions.
- Enhanced query handling in `InvoicingPeriodDraftOverlayFakeDb` to validate SQL constraints and column cache resets in overlapping invoicing contexts.
2026-05-11 18:18:08 +02:00
Jeppe Bundgaard a71bde3211 Remove legacy booking completion forms and related logic
- Deleted `complete_booking_f` and `generate_booking_wash_certificate_f` classes.
- Updated tests to ensure legacy booking completion routes are disabled.
- Introduced tests for POST `/order-bookings/complete` to enforce POS-based booking completion management.
- Added `/collected-invoices/split-by-month` route with API and unit tests for splitting collections into monthly periods.
- Refactored impacted files to exclude legacy references and ensure continued compatibility with POS processes.
2026-05-06 14:02:48 +02:00
Jeppe Bundgaard 7d450e285e Remove outdated edge gateway object classes, add new agent implementation
Transitioned from obsolete gateway object classes (`edge_gateway_shell_action_jobs_o`, `edge_gateway_shell_events_o`, `edge_gateway_shell_sessions_o`, `edge_gateway_update_jobs_o`) to the new agent implementation (`edge-gateway-agent/agent.php`).
2026-04-21 14:13:17 +02:00
Jeppe Bundgaard 653680376a Add unit and integration tests for collected invoice queue handling, route hardening, lifecycle validation, and manual batch processing logic. 2026-04-08 15:53:22 +02:00
Jeppe Bundgaard c5cd42be7f Add unit and integration tests for economic_transfer_queue and related endpoints, replacing synchronous fallback methods with queue-based processing. 2026-04-08 12:29:57 +02:00
Jeppe Bundgaard ba23ad6e8f Add economic_transfer_executor and economic_transfer_queue classes for handling e-conomic invoice transfer logic, queue management, and processing. Include unit tests for Redis cache validation. 2026-04-08 11:20:08 +02:00
Jeppe Bundgaard 4ef20a1c90 Add economic V2 modules for history backfill, comparison, and distribution services. 2026-03-12 17:57:27 +01:00
Jeppe Bundgaard 8a5a7294ab Refactor invoice comparison logic and deprecate temporary route
- Enhance `/collected-invoices/economic/compare` with improved HTTP status determination and response structure.
- Add handling for `draft_total` and `booked_total` comparisons against internal totals.
- Deprecate `/tmp-customer-list-overcharged` route with error response.
- Update OpenAPI documentation for `compareCollectedInvoiceEconomic` endpoint.
- Introduce `CollectedInvoiceEconomicCompareResponse` schema for consistent API responses.
- Comment out unused return data and debug code for clarity.
2026-02-03 15:08:21 +01:00
Jeppe Bundgaard 58a5f5a26a Add route to compare collected order invoices with E-Conomic
- Introduce `/collected-invoices/economic/compare` endpoint for superusers.
- Enable validation and comparison of draft and booked invoice totals from E-Conomic against internal data.
- Add detailed error handling and warnings for mismatches and retrieval failures.
2026-02-03 12:19:56 +01:00
Jeppe Bundgaard ab93866295 Add Redis connection checks and optimize caching for collected order invoices
- Enhance Redis methods (`exists`, `setEx`, `delete`, `get`, `set`) to ensure connection before execution.
- Introduce short-lived caching for collected order invoices to minimize redundant processing and improve performance.
- Add `pagination_helper` for dynamic WHERE clause construction in queries.
- Refactor net amount calculation in `collected_order_invoices_o` for efficiency with batch processing.
- Extend `listObjectsWithPaginationIfSet` to support additional WHERE clauses.
2026-02-03 11:43:56 +01:00
Jeppe Bundgaard 6f1fc86656 Fix typo in collected order invoice logic comments 2025-11-04 16:58:52 +01:00
Jeppe Bundgaard c2a5bad0a8 Improve error handling for draft invoice lines and refine invoice collection logic
- Added detailed error handling in `economic_invoices_draft_endpoint` to throw exceptions with line-specific error messages when adding draft invoice lines fails.
- Removed unnecessary `echo` statement from `orderInvoicesRoute`.
- Updated `collected_order_invoices_o` to allow empty invoice collections for customers with fixed price agreements.
2025-09-02 15:49:39 +02:00
Jeppe Bundgaard 5f400e1dd0 Add advanced invoice handling, cached result lookups, and customer-specific pricing
- Enhanced `orderInvoicesRoute` with `reset`, `unlink`, and `remove-special-arrangements` handlers for invoice actions, improving E-Conomic integration.
- Added `resetPricesOfItemsNotIncludedInInvoice`, `setAllItemsToBeIncludedInInvoice`, and `unlinkFromEconomic` methods in `collected_order_invoices_o` for robust invoice control.
- Introduced `getCustomerProductPrice` in `orders_o` to calculate customer-specific product pricing with discounts.
- Added `getCachedResultsBySubstring` in `motorapi_lookups_o` for efficient cached lookup based on result substrings.
2025-08-25 15:59:03 +02:00
Jepp9350 0eda58bcba Add vehicle subscription handling for customers without fixed pricing in order invoice processing 2025-06-01 20:24:03 +02:00
Jepp9350 84b6d4de3e Fix incorrect date handling for closing order invoices
Replaced `created_at` with `closed_at` to accurately set the timestamp when closing collected order invoices. This ensures the correct date is applied during the invoice update process.
2025-05-06 12:14:41 +02:00
Jepp9350 be9ba1a2fa Add fixed pricing logic for order invoices
Introduced a check to apply fixed pricing for customers with predefined rates. This ensures that customer-specific fixed prices override default prices before adding invoices to E-Conomic. The change improves pricing consistency and accuracy for eligible customers.
2025-05-05 16:42:03 +02:00
Jepp9350 30ff7d385e Add support for fixed pricing in collected order invoices
Introduced functionality to handle fixed prices for collected order invoices, allowing customer-specific pricing overrides. Added a new route and methods to integrate fixed pricing logic, modify invoice items, and ensure proper data management in E-Conomic. Adjusted discount calculations to accommodate cases where final price is zero.
2025-05-05 16:21:31 +02:00
Jepp9350 8d2fe8d75d Add support for closed_at field in order invoices
Introduce the closed_at field to track closure dates for order invoices. Updated validation, processing logic, and database integration to ensure correct handling of the new field. Adjusted related routes to pass and store the closed_at value where applicable.
2025-05-01 15:45:59 +02:00
Jepp9350 29e76b58d8 Fix and enhance order processing with improved data handling
Set proper timestamps for collected invoices and added `getLastOrderId` for vehicles. Streamlined order fetching logic by fixing parameter usage, refining customer and order item retrieval, and improving type casting in multiple methods.
2025-04-29 15:22:26 +02:00
Jepp9350 6cc5e6bbf0 Add custom routes, subscription features, and refactor orders
Introduced a new POST route for collected vehicle subscription invoices and enhanced responses with wash subscription transactions. Refactored order handling by adding department-based pricing logic and simplifying reusable methods. Various minor improvements include exception handling, input validation, and updated permissions.
2025-04-28 14:24:11 +02:00
Jepp9350 26ccab3d3c Add endpoint for booking collected invoices to Stripe
Introduce a new POST endpoint to handle adding collected order invoices to Stripe, with necessary validations and logging. Extend `collected_order_invoices_o` to include Stripe integration, fetching details of Stripe payment intents when applicable.
2025-04-22 12:01:55 +02:00
Jepp9350 7b82be6c57 Implement vehicle subscription handling and department SMS feature
Added functionality to handle vehicle subscriptions in invoices, including validation and item visibility. Introduced department notification SMS capability with endpoints for creating, retrieving, and deleting SMS records. Enhanced invoice drafting logic to exclude items not flagged for inclusion in invoices.
2025-04-14 16:03:29 +02:00
Jepp9350 b6f2629bed Add invoice splitting, booking notifications, and minor fixes
Implemented functionality to split collected order invoices, ensuring proper validation and handling processor constraints. Added a notification system to inform departments about new bookings via Slack or SMS. Also, included minor enhancements such as a corrected Gateway API URL and improved form handling for wash certificate emails.
2025-04-11 09:39:49 +02:00
Jepp9350 a73a715000 Add functionality to handle error checking in Economic module
Introduce a new route for running error checks and implement a method to evaluate and clear specific invoice errors. Enhance draft handling with additional error checks and new helper methods to fetch and manage draft invoices.
2025-04-07 10:13:55 +02:00
Jepp9350 60bcbb6e75 Enhance invoice handling and filtering mechanisms
Refactored invoice draft handling to improve error checks, added support for optional fetch skipping, and enhanced currency management. Expanded filtering capabilities with date range and attribute-based filters. Adjusted Nginx config to increase FastCGI read timeout for long-running processes.
2025-04-07 07:43:47 +02:00
Jepp9350 ab91909fb3 Add "NOT ZERO" filter for active invoices validation
Introduced a "NOT ZERO" filter in `db_object_t` to enable stricter checks for fields with non-zero values. Applied this filter to enforce restrictions on active invoices in relevant routes to improve data consistency and validation accuracy.
2025-04-02 16:17:44 +02:00
Jepp9350 8bc4252089 Add Economic invoice overview and draft check functionalities
Introduce new endpoints for viewing Economic invoice summaries and running draft checks. Implement `economic_tasks` helper for managing draft validations, and enhance `collected_order_invoices_o` and SQL clauses to improve query flexibility, including handling "NOT NULL" filters.
2025-04-02 15:08:57 +02:00
Jepp9350 02b91b4c77 Update invoice handling to support custom dates and validations
Modified functionalities for creating invoice drafts by adding support for custom dates and enhanced validations. Updated methods now check and validate date formats, handle booked invoice collections, and ensure proper invoice creation workflows.
2025-04-01 15:38:27 +02:00
Jepp9350 f9379d6c14 Remove unused collected invoices transactions route
The /collected-invoices/transactions route was removed as it was no longer in use. Removing this unused code improves maintainability and reduces potential confusion in the codebase.
2025-04-01 11:54:46 +02:00
Jepp9350 5f65c5ea65 Add new routes and enhance invoice handling in backend
Introduced new superuser-only routes for handling collected invoices, including viewing invoices per order/month, invoice totals, and transactions. Enhanced validation for invoice closure with processors and added support for database views in multiple classes and objects. These updates improve backend functionality and data granularity while maintaining strict permission control.
2025-04-01 11:53:54 +02:00
Jepp9350 a5cfbf64e4 Refactor order invoice handling and add PDF generation feature
Refactored `orderInvoicesRoute` to use a central method for fetching invoice details, reducing code duplication. Added functionality for generating and storing material transaction PDFs using a new HTML2PDF template. Updated database handling for accommodating null filters and enhanced customer data retrieval in orders.
2025-03-28 16:53:18 +01:00
Jepp9350 82a6349218 Add booking confirmation email functionality
Implemented a new booking confirmation email template and its integration with email sending functionality. Updated form handling to trigger confirmation email after submission and enhanced error handling on department validation.
2025-03-24 14:40:22 +01:00
Jepp9350 411b11365d Refactor orderInvoicesRoute to clean up unused code.
Removed commented-out code snippets for better readability and maintainability. This streamlines the logic by eliminating unused query modifications and debug artifacts.
2025-03-13 14:36:17 +01:00
Jepp9350 32f0a1548f Add customer-specific filtering and refactor order invoice logic
Introduced customer attribute-based filtering for individual invoicing and enhanced collected order invoice processing with proper associations to customers and orders. Added new endpoints, fields, and utility methods to streamline data retrieval, ensure consistency, and support new use cases like 'Ready to Invoice'. Includes minor fixes, validations, and optimizations throughout the affected modules.
2025-03-13 14:35:49 +01:00
Jepp9350 b3c4e9696f Refactor invoice handling and add total net amount calculation
Introduce logic for validating booked and draft invoices in E-conomic. Add methods to calculate the total net amount for invoice collections and improve error handling for specific invoice states. Updated related workflows to ensure consistent validation and data integrity.
2025-03-07 16:22:14 +01:00
Jepp9350 2042f0c00a Add capability to sync collected invoices to E-Conomic
Introduced a new endpoint for syncing collected order invoices with E-Conomic via a POST route. Added methods for creating, managing, and closing invoice drafts in E-Conomic. The implementation includes validations, external ID handling, and seamless integration of payment terms and layout configurations.
2025-03-03 15:36:58 +01:00
Jepp9350 dc419e1715 Remove unused MotorAPI license plate lookup endpoint
The `/modules/motorapi/lookup` route has been removed as it is no longer needed. This cleanup reduces codebase clutter and eliminates outdated or redundant functionality.
2025-03-03 12:18:36 +01:00
Jepp9350 e9aeedc327 Add invoice collection assignment logic to orders and users
Introduced methods to manage, assign, and retrieve invoice collections for orders and users. Enhanced the system to support flexible invoice grouping, including per-order logic and automated assignment to open or newly created invoice collections.
2025-02-28 13:50:27 +01:00
Jepp9350 9bf0355e47 Add routes and objects for managing collected order invoices
Introduced GET and POST endpoints for collected order invoices, enabling listing and creation functionalities for authorized users. Added a new database object to handle invoice-related operations and validations. Included utility functions to enforce parameter requirements and data integrity.
2025-02-28 12:07:46 +01:00