Skip to main content

Mapping: Order Close

Context

Step Definitions

Background

  • Given an Order exists...: Prerequisite state in DB.
  • And I am logged in...: WepSession context.

Actions

  • I am on the Close Order page: OrderController.Close (GET)

    • Logic: Calls OrderService.GetOrderOMGT(..., "OMGT_CLOSE_ORDER").
    • View: Returns View(new OrderCloseDto(...)).
  • I select Status ...: Sets OrderCloseDto.OrderStatus

  • I submit the form: OrderController.Close (POST)

Validations using Entity Logic (OrderOMGT.CloseOrder)

  • Operator Mandatory: If CancelWithReorientation, checks changeStatus.COMOperator.
  • Status Integrity: Checks if status is ARCHIVED or CANCELED.

Outcomes

  • Order Status Updated: Calls OrderService.CloseOrder.

    • Updates OrderOMGT entity (ClosedOn, ClosedReasonId, ClosedUnderWepGuarantee).
  • Gherkin Step: the same status is automatically cascaded to all associated products

  • Code Location: OrderOMGT.CloseOrder (Loop over OrderTravelProductOMGTs)

  • Gherkin Step: a new fee/discount line ... is added to the order

  • Code Location: OrderService.CloseOrderProgramBalance -> OrderFeeComponentService.AddFeeToOrder

  • Gherkin Step: a request for a credit note or correction invoice is generated

  • Code Location: OrderService.CloseOrderInvoiceBalance -> IWepInvoiceRequestHandler.RequestFeeInvoicingAsync

  • Gherkin Step: a new "AdminReasonHistoryOMGT" record is created

  • Code Location: WepOMGTLogItemNotificationSubscriber.HandleEITEvent (Triggered by CLOSE_ORDER)

  • Gherkin Step: the "DesactivateAppForm" service is called

  • Code Location: OrderService.CloseOrder -> MyWepComponentService.DesactivateAppForm

    • Cascade Update: Updates Status of all child OrderTravelProductOMGTs to match order status.
    • Financial Flags: Sets IsMissingCreditNote if invoice exists without credit note.
    • Updates IsNotOKForAutomatedProcesses based on Prospect contact.
  • Prospect Updates: ProspectCRM.DisableForContact / EnableForContact.

  • Zoho Sync: ZohoApiSDKManager.UpdateRecord and SetOptOut.

  • Emails Sent: OrderService.HandleCommunication

    • Accounting: Template OMGT_ACCOUNTING_CANCEL_ARCHIVE_ORDER.
    • Operator: Template OMGT_NOTIFY_OPERATOR_REORIENTATION.
  • Redirect: Returns RedirectToAction("Overview") or RedirectToAction("Manage", "FinancialTransactionOMGTs").