Phase 1 + 2: multi-tenant scoping trait + settings-driven PayFile payment method#5
Open
TLemmAI wants to merge 22 commits intofleetbase:mainfrom
Open
Phase 1 + 2: multi-tenant scoping trait + settings-driven PayFile payment method#5TLemmAI wants to merge 22 commits intofleetbase:mainfrom
TLemmAI wants to merge 22 commits intofleetbase:mainfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sGlAssignments trait Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…egistration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Rule models Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d auto-approve rules Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…invoices tables Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…odels Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e, InvoiceNumberGenerator Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ents and client invoices Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…culation service, and event integration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. Rate unit conversion: benchmark_rate now converted to flat expected_total based on rate_unit (flat/per_mile/per_cwt) before comparing to actual cost. Missing miles or weight safely skips instead of producing wrong numbers. 2. Loss/break-even tracking: all calculable outcomes now recorded including losses, break-even, and below-threshold. New result_type column classifies each execution. Shares are 0 for non-savings results. 3. Deduplication: checks for existing execution with same shipment_uuid + gainshare_rule_uuid. Updates existing record instead of inserting duplicates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…act future hook - New benchmark_source field on gainshare_rules (default: cost_benchmark) - Service branches on benchmark_source: cost_benchmark runs existing logic, rate_contract returns null safely (not yet implemented) - Added getBenchmarkFromRateContract() stub for BUILD-10 integration - No changes to existing calculation math or result_type logic Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ting engine - benchmark_source = 'rate_contract' now resolves expected_total via RateShopService::calculateForContract() against a deterministically-selected RateContract (does NOT rate-shop all carriers). - Selection priority: customer-specific > generic, dedicated cost_management_benchmark usage > both, most recent effective_date, then UUID for full determinism. - Refactored to share dedup/savings/classification/storage logic between both benchmark sources — financial safety guarantees identical for both paths. - cost_benchmark path remains 100% unchanged. - benchmark_source recorded in execution.meta for audit visibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
POST /carrier-invoices/batch-approve bulk-approves invoices using the existing resolve() flow per-invoice so GL assignment and gainshare events fire normally. Skips invoices not in audited/in_review state with a reason. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…erviceAgreement, PayFile
…ySettingsResolver
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.
Summary
Part of the upstream fleetbase Phase 1 + 2 TMS productization consolidation.
Phase 1 (commit 963bef4)
Apply the new
Fleetbase\Models\Concerns\ScopedToCompanyContexttrait (from core-api) to the tenant-owned ledger models:CarrierInvoiceServiceAgreementPayFileLocal scope only — existing queries are unaffected unless callers explicitly chain
->inCompanyContext().Phase 2 (commit f149738)
PayFileGeneratorService— replace the hardcodedpayment_method = 'ach'default with a resolver lookup viaFleetbase\Support\CompanySettingsResolver::forCompany($uuid)->get('pay_files.default_payment_method'). Per-company overrides and parent→client inheritance now flow through the new settings surface.Dependencies
Test plan
docker run ... ./vendor/bin/pest tests/Feature/→ 116 passedpay_files.default_payment_method = 'wire'on a test company, generate pay file, verify item'spayment_methodreflects the setting.