Customer Users Postman Doc: https://documenter.getpostman.com/view/20499442/[merchant-collection-id] -------------------------------------------------------------------------------- API: Fetch Customers (List) -------------------------------------------------------------------------------- GET /merchant/api/v1/domains/:domain_id/customers [Seller Admin, Orchestration] Description: List and filter customers with pagination and sorting support. Query Parameters: - sort: Field to sort by (e.g., "first_name", "email", "total_orders") - order: Sort order ("asc" or "desc") - first_name: Filter by first name - last_name: Filter by last name - email: Filter by email address - bool_email_verified: Filter by email verification status (true/false) - bool_phone_verified: Filter by phone verification status (true/false) - num_total_orders: Filter by exact number of total orders - gte_total_order_amount: Filter by minimum total order amount - page: Page number for pagination - size: Number of results per page Response: 200 OK { "data": [ { "id": "uuid", "tenant_id": "...", "email": "customer@example.com", "phone": "+1234567890", "registration_source": "EMAIL_PASSWORD", "enabled": true, "approved": true, "email_verified": true, "phone_verified": false, "first_name": "John", "last_name": "Doe", "group_id": "uuid", "group_name": "Silver", "last_active_on": "2024-12-30T10:41:36.000+00:00", "total_orders": 10, "total_order_amount": 500.00, "status": "active" } ], "pagination": { "page": 1, "size": 20, "total": 100 } } Flow Sequence: # Step 1: Validate Token at Gateway Level (JWT validation) # Step 2: Query Customer Data GET /api/customer_users?domain_id=:domain_id&... [Customer Service, Core Microservices] # Step 3: Return paginated customer results -------------------------------------------------------------------------------- API: Get Customer -------------------------------------------------------------------------------- GET /merchant/api/v1/domains/:domain_id/customers/:id [Seller Admin, Orchestration] Description: Retrieve detailed customer profile including group information. Response: 200 OK { "id": "uuid", "tenant_id": "...", "email": "customer@example.com", "phone": "+1234567890", "registration_source": "EMAIL_PASSWORD", "enabled": true, "approved": true, "email_verified": true, "phone_verified": false, "first_name": "John", "last_name": "Doe", "group_id": "uuid", "group_name": "Silver", "last_active_on": "2024-12-30T10:41:36.000+00:00", "total_orders": 10, "total_order_amount": 500.00, "status": "active" } Flow Sequence: # Step 1: Validate Token at Gateway Level (JWT validation) # Step 2: Get Customer Profile GET /api/customer_users/:id [Customer Service, Core Microservices] # Step 3: Fetch Addresses (optional) GET /api/addresses?customer_id=:id [Customer Service] -------------------------------------------------------------------------------- API: Create Customer -------------------------------------------------------------------------------- POST /merchant/api/v1/domains/:domain_id/customers [Seller Admin, Orchestration] Description: Create a new customer under the domain. Request Body: { "email": "newcustomer@example.com", "registration_source": "EMAIL_PASSWORD", "enabled": true, "approved": false, "email_verified": false, "phone_verified": false, "first_name": "Jane", "last_name": "Doe", "tenant_id": "..." } Response: 201 Created with customer object Flow Sequence: # Step 1: Validate Token at Gateway Level (JWT validation) # Step 2: Validate Request Body # Step 3: Create Customer Record POST /api/customer_users [Customer Service, Core Microservices] # Step 4: Log Event POST /api/events/log [Util Service] -------------------------------------------------------------------------------- API: Update Customer -------------------------------------------------------------------------------- PUT /merchant/api/v1/domains/:domain_id/customers/:id [Seller Admin, Orchestration] Description: Update customer profile information. Request Body (partial update): { "first_name": "Updated", "last_name": "Name", "enabled": true, "approved": true, "group_id": "uuid" } Response: 200 OK with updated customer object Flow Sequence: # Step 1: Validate Token at Gateway Level (JWT validation) # Step 2: Update Customer Record PUT /api/customer_users/:id [Customer Service, Core Microservices] # Step 3: Log Event POST /api/events/log [Util Service] -------------------------------------------------------------------------------- API: Delete Customer -------------------------------------------------------------------------------- DELETE /merchant/api/v1/domains/:domain_id/customers/:id [Seller Admin, Orchestration] Description: Delete a customer from the domain. Response: 204 No Content Flow Sequence: # Step 1: Validate Token at Gateway Level (JWT validation) # Step 2: Delete Customer Record DELETE /api/customer_users/:id [Customer Service, Core Microservices] # Step 3: Log Event POST /api/events/log [Util Service] -------------------------------------------------------------------------------- API: Export Customers (CSV) -------------------------------------------------------------------------------- GET /merchant/api/v1/domains/:domain_id/customers/csv [Seller Admin, Orchestration] Description: Export customers to CSV format for reporting. Query Parameters: - customer_ids: Comma-separated list of customer IDs to export (optional) - email: Filter by email address (optional) Response: 200 OK (Content-Type: text/csv) id,tenant_id,email,registration_source,enabled,approved,email_verified,phone_verified,group_id,group_name,last_active_on,total_orders,total_order_amount uuid,data,customer@example.com,EMAIL_PASSWORD,True,False,False,False,Silver,Silver,2024-12-30T10:41:36.000+00:00,10,20 Flow Sequence: # Step 1: Validate Token at Gateway Level (JWT validation) # Step 2: Query Customer Data GET /api/customer_users?domain_id=:domain_id&... [Customer Service, Core Microservices] # Step 3: Format and return CSV response Notes: - Token validation happens at the Seller API Gateway level (JWT validation) - All customer operations are domain-scoped - registration_source values: EMAIL_PASSWORD, GOOGLE, FACEBOOK, PHONE, etc. - Customer groups (group_id, group_name) are used for segmentation and pricing tiers