[!WARNING] Unverified Interpretation - This mapping was extracted via Code Archaeology and requires USER validation.
Mapping: OrderFeeLineLifecycle
This document provides the technical mapping between Gherkin scenarios in OrderFeeLineLifecycle.feature and the legacy codebase.
Source Files
| File | Lines | Purpose |
|---|---|---|
| OrderFeeComponentService.cs | 1852 | Main service containing fee CRUD and lifecycle logic |
| OrderFeeBusinessRule.cs | 21 | Placeholder for business rules (currently empty) |
Business Rule Mappings
BR-OMGT-010: Group Medical Insurance Propagation
- Scenario: Add medical insurance supplement to a Group Order
- Code Location:
AddFeeToOrderL573-610 - Pseudocode:
IF (fee is TravelInsuranceSupplement OR TravelInsuranceDiscount)
AND order.IsGroup
AND order.GetGroupOMGT().IsMedicalInsuranceProcessSameForAll
THEN
FOR EACH order IN group.GetAllOrders()
IF NOT order.ExcludeAccounting
AddFeeToOrderGo(fee, order)
ELSE
HandleAddMedicalInsuranceFeeOMGT(order) // Only update process
BR-OMGT-011: Cancel Insurance Percentage Calculation
- Scenario: Proposed fee triggers linked Cancel Insurance calculation
- Code Location:
AddProposedFeeToOrderL508-532 - Pseudocode:
IF fee.TypeOfFee has ProposalCancelInsuranceFeeOMGTId
AND country.HasCancelInsurance()
AND country.IsCancelInsCalculationInPercentage(programId)
THEN
cancelInsRate = country.CalculateCancelInsRate(programId, fee.EndUserPrice)
CREATE new OrderAddFeeDTO:
Amount = fee.EndUserPrice * cancelInsRate / 100
FeeId = cancelId
CancellationOfOrderFeeLineId = fee.Id
BR-OMGT-012: Deferred Discount Invoicing
- Scenario: Discount invoicing is deferred when Acceptance Invoice not yet requested
- Code Location:
HandleAccountingL897-913 - Pseudocode:
IF office.IsInvoicingActive AND NOT doNotInvoice
IF order.AcceptanceInvoiceRequestedOn.HasValue
OR fee.type != Discount
OR forceInvoicing
THEN
invoiceRequestHandler.RequestFeeInvoicingAsync(fee)
ELSE
fee.ToInvoice = TRUE
RAISE DISCOUNT_ADDED_BUT_NOT_INVOICED
BR-OMGT-013: Travel Insurance Type Change on Supplement
- Scenario: Validating Travel Insurance supplement changes insurance type
- Code Location:
HandleAddMedicalInsuranceFeeOMGTL1006-1056 - Pseudocode:
IF fee.IsTravelInsuranceSupplement AND fee.Status == VALIDATED
FOR EACH travelInsurance IN order.TravelInsuranceRequests
CASE travelInsurance.Type OF
N/A, PARTICIPANT:
SET Type = WEP
PARTNER (INBOUND):
REPLACE with WEP
PARTNER (OUTBOUND):
CREATE new WEP request
WEP (if booked):
SET Status = TO_EXTEND
BR-OMGT-014: Status Change Email Notifications
- Scenario: Status change with email notification
- Code Location:
ChangeStatus(int id, ...)L742-776 - Pseudocode:
IF sendEmails == TRUE AND status change SUCCESS
SEND email template: NOTIFY_PAX_PROPOSAL_ACCEPTED_BY_PAX
SEND email template: NOTIFY_STAFF_PROPOSAL_ACCEPTED_BY_PAX
BR-OMGT-015: Delete Fee Group Propagation
- Scenario: Delete travel insurance fee propagates to group
- Code Location:
DeleteFeeL1245-1300 - Pseudocode:
IF fee.IsTravelInsurance()
AND order.IsGroup
AND group.IsMedicalInsuranceProcessSameForAll
THEN
FOR EACH order IN group.GetAllOrders()
IF NOT order.ExcludeAccounting
DeleteFeeGo(order, matchingFee)
BR-OMGT-016: Travel Insurance Extension Availability
- Scenario: Travel insurance extension only available when insurance is booked
- Code Location:
GetAvailableSupplementL1823-1836 - Pseudocode:
IF travelInsurance.Type IN (WEP, PARTNER_BUT_WEP) AND NOT BookedOn.HasValue
EXCLUDE: FEE_MEDICAL_INS_BASIC_EXTENSION, FEE_MEDICAL_INS_EXTENDED_EXTENSION
IF travelInsurance.Type IN (WEP, PARTNER_BUT_WEP) AND BookedOn.HasValue
EXCLUDE: FEE_MEDICAL_INS_BASIC, FEE_MEDICAL_INS_EXTENDED
BR-OMGT-017: Order Price Recalculation After Fee Change
- Scenario: Any fee modification triggers order price recalculation
- Code Location:
AddNewOrderFeeLineL1169-1174,DeleteFeeGoL1310-1313 - Pseudocode:
AFTER fee add/edit/delete:
FOR EACH orderHeader IN order.GetOrderHeaders()
orderHeader.HandleChangePricing(false)
THEN
order.HandleChangeInAccounting()
State Transition Matrix
| Current Status | → VALIDATED | → CANCELED | → PROPOSITION_CANCELED |
|---|---|---|---|
| PROPOSED | ✅ Billing + Accounting | ❌ | ✅ Log only |
| VALIDATED | ❌ | ✅ Accounting Cancel | ❌ |
| PROPOSITION_CANCELED | ❌ | ❌ | ❌ |
| PROPOSITION_OUT_OF_DATE | ❌ | ❌ | ❌ |
Open Questions
- Cascade Validation: When validating a CancelInsurance child, should we ALWAYS cascade to parent, or only if parent is still PROPOSED?
- ExcludeAccounting Orders: What is the exact scenario where an order in a group has
ExcludeAccounting = TRUE? - ForceInvoicing: Under what circumstances should
forceInvoicingbe TRUE? Only status changes?