Skip to main content

Business Rule Candidates: OrderFee Module

[!WARNING] Unverified Interpretation - These rules were extracted via Code Archaeology and require USER validation before promotion to specs/current/.


Candidate List

IDTitleStatusEvidence
BR-OMGT-010Group Medical Insurance Propagation🔍 To VerifyOrderFeeComponentService.cs:L573-610
BR-OMGT-011Cancel Insurance Percentage Calculation🔍 To VerifyOrderFeeComponentService.cs:L508-532
BR-OMGT-012Deferred Discount Invoicing🔍 To VerifyOrderFeeComponentService.cs:L897-913
BR-OMGT-013Travel Insurance Type Change on Supplement🔍 To VerifyOrderFeeComponentService.cs:L1006-1056
BR-OMGT-014Status Change Email Notifications🔍 To VerifyOrderFeeComponentService.cs:L742-776
BR-OMGT-015Delete Fee Group Propagation🔍 To VerifyOrderFeeComponentService.cs:L1260-1281
BR-OMGT-016Travel Insurance Extension Availability🔍 To VerifyOrderFeeComponentService.cs:L1823-1836
BR-OMGT-017Order Price Recalculation After Fee Change🔍 To VerifyOrderFeeComponentService.cs:L1169-1174

Detailed Definitions

BR-OMGT-010: Group Medical Insurance Propagation

  • Context: Group order fee management
  • Constraint: When adding/deleting a Travel Insurance supplement to a group order where IsMedicalInsuranceProcessSameForAll = TRUE, the operation MUST be applied to ALL orders in the group.
  • Exception: Orders with ExcludeAccounting = TRUE only receive process updates, not the fee itself.
  • Logic:
IF (fee is TravelInsuranceSupplement OR TravelInsuranceDiscount)
AND order.IsGroup
AND group.IsMedicalInsuranceProcessSameForAll
THEN propagate to all group orders

BR-OMGT-011: Cancel Insurance Percentage Calculation

  • Context: Fee proposal with linked cancel insurance
  • Constraint: When proposing a fee with ProposalCancelInsuranceFeeOMGTId, if the country uses percentage-based calculation, a linked CancelInsurance fee is auto-created.
  • Formula: CancelInsAmount = EndUserPrice * CancelInsRate / 100
  • Logic:
IF TypeOfFee.ProposalCancelInsuranceFeeOMGTId IS SET
AND country.HasCancelInsurance()
AND country.IsCancelInsCalculationInPercentage(programId)
THEN auto-create linked CancelInsurance fee

BR-OMGT-012: Deferred Discount Invoicing

  • Context: Discount invoicing timing
  • Constraint: Discounts are NOT immediately invoiced. They are marked ToInvoice = TRUE and invoiced only after AcceptanceInvoiceRequestedOn is set.
  • Exception: forceInvoicing = TRUE bypasses this rule.
  • Logic:
IF fee.type == Discount
AND NOT order.AcceptanceInvoiceRequestedOn.HasValue
AND NOT forceInvoicing
THEN set ToInvoice = TRUE, defer invoicing

BR-OMGT-013: Travel Insurance Type Change on Supplement

  • Context: Travel insurance process management
  • Constraint: Validating a TravelInsurance supplement fee triggers automatic insurance type transitions.
  • Transitions:
    • N/A or PARTICIPANTWEP
    • PARTNER (Inbound) → Replace with WEP
    • PARTNER (Outbound) → Create new WEP request (keep PARTNER)
    • WEP (if booked) → Set status to TO_EXTEND

BR-OMGT-014: Status Change Email Notifications

  • Context: Fee proposal acceptance workflow
  • Constraint: When sendEmails = TRUE and status changes from PROPOSED to VALIDATED, send notifications to both PAX/LG and Staff.
  • Templates: NOTIFY_PAX_PROPOSAL_ACCEPTED_BY_PAX, NOTIFY_STAFF_PROPOSAL_ACCEPTED_BY_PAX

BR-OMGT-015: Delete Fee Group Propagation

  • Context: Group order fee deletion
  • Constraint: Mirrors BR-OMGT-010 for deletions. Deleting a TravelInsurance fee propagates to all group orders.
  • Logic: Same as BR-OMGT-010 but for deletion operation.

BR-OMGT-016: Travel Insurance Extension Availability

  • Context: Available fee filtering
  • Constraint: Medical insurance extensions are only available when base insurance is booked. Base insurance is unavailable after booking.
  • Rules:
    • BookedOn = NULL → Exclude Extension fees
    • BookedOn IS SET → Exclude Base fees, Allow Extensions

BR-OMGT-017: Order Price Recalculation After Fee Change

  • Context: Order pricing integrity
  • Constraint: ANY fee add/edit/delete operation MUST trigger HandleChangePricing() on all OrderHeaders and HandleChangeInAccounting() on the OrderOMGT.
  • Atomic: This is a mandatory post-operation step.

Next Steps

  1. Validation: Creator reviews each rule for correctness.
  2. Promotion: Validated rules move to specs/current/ and are registered in business_rules_index.md.
  3. Expand: Rules with complex logic get full Gherkin coverage.