%%{init: { "theme": "base", "themeVariables": { "fontSize": "18px", "background": "transparent", "actorBkg": "#038851", "actorTextColor": "#ffffff", "actorBorder": "#026139", "actorLineColor": "#94a3b8", "signalColor": "#64748b", "signalTextColor": "#059669", "noteBkgColor": "#e6f4ee", "noteTextColor": "#02502f", "noteBorderColor": "#038851", "activationBkgColor": "#c6ebdc", "activationBorderColor": "#026139", "sequenceNumberColor": "#ffffff" }, "sequence": { "useMaxWidth": true, "actorMargin": 70, "width": 150, "height": 60, "boxMargin": 12, "noteMargin": 14, "messageMargin": 50, "diagramMarginX": 20, "diagramMarginY": 20, "actorFontSize": 18, "actorFontWeight": 700, "noteFontSize": 15, "noteFontFamily": "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace", "messageFontSize": 16, "messageFontWeight": 700, "noteAlign": "left", "mirrorActors": false } }}%%
sequenceDiagram
actor Customer
participant Platform as Ordering Platform
participant CRM as Deliverect CRM API
Note over Customer,CRM: Identify customer at checkout
%% Lookup / Create
Customer->>Platform: Provide email at checkout
Platform->>CRM: POST /crm/account/{accountId} (Lookup Customer by Email)<br/>body: { email }
alt Customer exists
CRM-->>Platform: 200 { externalId, loyaltyProviderId, deliveryAddresses, ... }
else Not found
Platform->>CRM: POST /crm/account/{accountId} (Create Customer)<br/>path: accountId, body: { contact, ... }
CRM-->>Platform: 200 { externalId, loyaltyProviderId, ... }
Note right of CRM: Must create<br> a customer<br/>before setting favorites
end
%% Read profile
Platform->>CRM: GET Customer Profile (by profile ID)
CRM-->>Platform: 200 customer profile
%% Updates
Note over Platform,CRM: Maintain customer data
Platform->>CRM: PATCH Update Customer Profile (partial update)
CRM-->>Platform: 200 updated profile
Platform->>CRM: PATCH Update Customer Delivery Addresses (full update)
CRM-->>Platform: 200 updated addresses
Platform->>CRM: PATCH Update Customer Vehicles (full update)
CRM-->>Platform: 200 updated vehicles
Platform->>CRM: PATCH Update Customer Favorites (full update)
CRM-->>Platform: 200 updated favorites
%% Read history & favorites
Note over Customer,CRM: Customer views history & favorites
Customer->>Platform: Open account / order history
Platform->>CRM: GET Customer Order History
CRM-->>Platform: 200 full order history
Platform->>CRM: GET CRM Order by Id
CRM-->>Platform: 200 specific order
Platform->>CRM: GET Customer Favorite Orders
CRM-->>Platform: 200 favorite orders
Platform-->>Customer: Display profile, history & favorites