Appearance
Customer Account Management
Flow ID: CF-11 | Module(s): eshop, Customer domain, CustomerSmsMarketing domain | Complexity: Medium Last Updated: 2026-11-04 — 4.129.0 resync: citations re-anchored; storefront and REST self-deletion now run
CustomerErasure::eraseAccount()(sanitizeAccount()), which also erases the account's other registered rows with the same email (#893/#894);DELETE /rest/customer/mestatus citations corrected; previous: 2026-10-13 — 4.127.0 resync: line citations torest_policies.phpre-based and theNotificationRecordsSteprange corrected (no behaviour change); previous, 2026-10-02 — 4.125.0 resync: account deletion / erasure documented (#855),DELETE /rest/customer/me, audit-log redaction, REST-session revocation on password change linked to CF-10 (#790), Known Issues & Security Gaps item 2 (#846); previously 2026-06-08
Business Overview
The customer account area provides profile management, order history with real-time courier tracking, wishlist, and password changes.
Key features:
- Dual address management (billing + shipping)
- Order tracking via encrypted URLs integrating with 12+ courier APIs
- Wishlist with AI recommendation sync
- Password change with current password verification
API Reference
REST Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /rest/customer/me | Customer JWT | Get own profile |
| POST | /rest/customer/me | Customer JWT | Update profile (restricted fields) |
| POST | /rest/customer/me/password | Customer JWT | Change password (ends the customer's other REST sessions and keeps the caller's — see "Password change and REST sessions" below) |
| DELETE | /rest/customer/me | Customer JWT | Delete own account; body {"password": "…"} required; see "Account Deletion / Erasure" below (application/config/rest_routes.php:643, locale twin :647; Customer::deleteMe() src/Rest/Customer/Controllers/Customer.php:402) |
| GET | /rest/customer/me/sms-marketing | Customer JWT | List own SMS-marketing subscriptions (optional filter[providerId]) |
| POST | /rest/customer/me/sms-marketing | Customer JWT | Opt in to a provider (upsert — updates phone if already subscribed) |
| DELETE | /rest/customer/me/sms-marketing/{providerId} | Customer JWT | Opt out of a provider (idempotent) |
| GET | /rest/order/order | Customer JWT | Order history |
Self-edit uses an allowlist: only fields in SELF_SERVICE_FIELDS (src/Rest/Customer/Controllers/Customer.php) are accepted. All other fields are silently dropped, including mail (matches legacy storefront behavior where the email input is disabled and Adv_customer::update_info() never saves it). Allowed: name, surname, landphone, mobilephone, birthdate, gender, billing address, shipping address, company details, profession, lang.
Legacy Storefront
| URL | Method | Purpose |
|---|---|---|
/customer/account_info | account_info() | Dashboard |
/customer/order_history | order_history() | Orders (pending/finished/canceled) |
/customer/order_track/{encrypted} | order_track() | Real-time tracking |
/customer/wishlist | wishlist() | Saved products |
/customer/update_info | update_info() | Edit billing address |
/customer/edit_shipping | edit_shipping() | Edit shipping address |
/customer/update_my_password | update_my_password() | Change password |
/customer/deleteUser | deleteUser() | Delete own account: sanitizeAccount((int) session customer_id) then logout() (ecommercen/eshop/controllers/Adv_customer.php:1526-1531); see "Account Deletion / Erasure" below |
Order Tracking
Encrypted order ID in URL → decrypted → resolves transporter → calls TrackAndTrace::track(). Supports: Geniki v1/v2, ACS, ELTA, Speedex, DHL, EasyMail, BoxNow, CyprusPost, Taxydema v1/v2, Center, ASAP.
Password change and REST sessions
The storefront password change (Adv_customer::update_my_password()) revokes the customer's REST sessions before it writes the new password (ecommercen/eshop/controllers/Adv_customer.php:544, helper revokeRestSessionsBeforePasswordWrite() :586-595, which calls Adv_customer_model::revokeRestSessions() ecommercen/eshop/models/Adv_customer_model.php:250-262). POST /rest/customer/me/password (Customer::changePassword()) ends every other session of the customer (RefreshTokenModel::revokeFamiliesExcept(), in one transaction with the write, so a failure of either changes nothing) and keeps the caller's, identified by the sid claim of its access token; a token without sid ends all of them (#954). See CF-10 Customer Auth, which owns sessions, logout and the #790 revocation rules.
Account Deletion / Erasure
This is the canonical description of what deleting a customer account does. Every path runs the same transactional operation in CustomerErasure (src/Domains/Customer/Customer/Erasure/CustomerErasure.php): erase() (:70) for the admin screen, the job and the cron, eraseAccount() (:82) for the two self-deletions, which also erases the account's other registered rows with the same email address (registeredSiblingIds(), :140-155). So every path deletes and keeps the same data.
Callers
| Caller | Entry point |
|---|---|
| Customer, storefront | GET /customer/deleteUser → Adv_customer::deleteUser(): sanitizeAccount((int) session customer_id) then logout() (ecommercen/eshop/controllers/Adv_customer.php:1526-1531); the account page links to it with a plain anchor (application/views/main/layouts/customer/account.php:175) |
| Customer, REST | DELETE /rest/customer/me → Customer::deleteMe() (src/Rest/Customer/Controllers/Customer.php:402) → AccountDeletionService::deleteWithPassword() (src/Domains/Customer/Customer/AccountDeletion/AccountDeletionService.php:37-46), which calls eraseAccount() (:43) |
| Admin | Adv_customers_admin::deleteUser($customerId) (ecommercen/eshop/controllers/Adv_customers_admin.php:347-352); see AD-04 Customer Management |
| Guest job and cron | AdvSanitizeGuestCustomers::executeCommand() (ecommercen/job/libraries/AdvSanitizeGuestCustomers.php:20-33) and Cronjob::sanitizeGuestCustomers() (application/controllers/Cronjob.php:398-409); see SY-09 Customer Data Jobs |
The admin, job and cron callers go through the legacy entry point Adv_sanitize_model::sanitizeAll($userIds) (ecommercen/eshop/models/Adv_sanitize_model.php:29-32); the storefront self-deletion goes through sanitizeAccount($customerId) (:41-44). Both delegate to CustomerErasure. REST calls the domain service, which calls eraseAccount().
What is deleted and what is kept
DELETED: the customer's product reviews (each affected product's rating is recomputed), the review-request log, wish-list, tags and campaigns, segment memberships, SMS-marketing consents, contact messages, the message log, the REST cart, REST refresh tokens, waiting-list entries and blog comments under the customer's address, and staff notes about the customer and their orders.
KEPT, every personal field cleared: orders, gift-card orders, marketplace orders and Skroutz invoice details (the country is kept for VAT), and the shop_customer row itself. That row ends with is_sanitized = 1, has_access = 0, an unusable password, and a unique undeliverable placeholder address ending in the order.invalid.email suffix (src/Domains/Customer/Customer/Erasure/Step/CustomerRecordStep.php:59-63; suffix injected from config at src/Domains/Customer/container.php:28-29).
KEPT, identity and payload cleared: the customer's REST_CUSTOMER rows in user_audit_logs (username, ip_address and params set to NULL; src/Domains/Customer/Customer/Erasure/Step/AuditTrailStep.php:35-37).
Steps
The steps run in this order (src/Domains/Customer/container.php:28-49), all under src/Domains/Customer/Customer/Erasure/Step/:
| # | Step | Effect |
|---|---|---|
| 1 | CustomerRecordStep | Clears the personal columns of shop_customer to NULL; mail becomes REPLACE(UUID(),'-','') plus the invalid-email suffix and password becomes SHA2(CONCAT(UUID(),RAND()),256); gender = 0, has_access = 0, is_sanitized = 1 |
| 2 | OrderRecordsStep | Keeps shop_order and gift_card_orders rows, clears their personal fields (OrderRecordsStep.php:50-51) |
| 3 | MarketplaceOrdersStep | Same for public_orders, skroutz_orders, skroutz_invoice_details, shopflix_orders |
| 4 | ReviewsStep | Deletes shop_product_reviews by customer_id (ReviewsStep.php:45), recomputes each affected product's rating via RatingAggregator::recomputeForProduct (:47-49), deletes shop_customer_reviews rows whose mail was one of the pre-anonymisation addresses (:51-52) |
| 5 | OwnedRecordsStep | Deletes wishlist, shop_customer_tag, shop_customer_campaign, shop_customer_audience, shop_customer_sms_marketing, shop_customer_message_history, shop_cart (OwnedRecordsStep.php:29-35), contact_emails (by id or address, :52) and shop_notes for the customer and their orders (:57, :64) |
| 6 | AddressKeyedRecordsStep | Deletes shop_waiting_list and blog_comments by the captured addresses (AddressKeyedRecordsStep.php:25-28) |
| 7 | SessionsStep | Deletes refresh_tokens (SessionsStep.php:31) |
| 8 | NotificationRecordsStep | Deletes the customer's notification_delivery, notification_message, notification_device and notification_customer_consent rows; clears notification_campaign.customer_id (NotificationRecordsStep.php:36-45) |
| 9 | AuditTrailStep | Clears identity and payload of the REST_CUSTOMER rows in user_audit_logs, keeping the rows (AuditTrailStep.php:26, :40) |
Transaction and failure
All steps run in one transaction (CustomerErasure.php:99-105); the ids, including the registered siblings of a self-deletion, are read inside it (:100). If the transaction fails, ErasureFailed::rolledBack is thrown (:107-109) and nothing is deleted. After a successful commit the service re-checks that every id is flagged is_sanitized and throws ErasureFailed::notFlagged otherwise (:111-120). There is no partial deletion; the failure is loud.
Callers handle it differently. Customer::deleteMe() catches ErasureFailed, logs it and answers 500 (src/Rest/Customer/Controllers/Customer.php:430-435). The storefront action, the admin action, the job and the cron do not catch it.
DELETE /rest/customer/me
The customer's id comes from the token, never from the request. Policy auth => customer (application/config/rest_policies.php:958). Password confirmation is required and goes through AdvauthPasswordVerifier. Wrong-password attempts are throttled with the sign-in limits, keyed by IP and customer id, in their own realm customer-account-deletion (src/Rest/Customer/Controllers/Customer.php:79, handling :402-446; constructor takes AccountDeletionService, LoginThrottle and RefreshTokenModel, :81-93).
| Status | Meaning |
|---|---|
| 200 | {success: true, message: "Account deleted."} (Customer.php:445) |
| 400 | No password, or an empty one (:408-411) |
| 401 | Wrong password; a throttle failure is recorded (:438-441), a correct one clears it (:444) |
| 404 | No such customer (:422-426) |
| 429 | Throttled, with Retry-After; while throttled even the right password is refused (:415-420) |
| 500 | ErasureFailed: logged, "The account could not be deleted…", rolled back, nothing deleted (:428-436) |
The access token already issued stays valid until it expires (stateless JWT), but the refresh tokens are deleted (SessionsStep), so nothing renews it. The client must discard its tokens. REST contract entry: application/config/rest_api_versions.php:120 (version 1.92).
Audit-log redaction
Request bodies recorded in user_audit_logs.params are masked before they are written: RequestParamsRedactor replaces with [redacted] the value of any key, at any depth and case-insensitively, that contains password, passwd, pwd, secret, token, cvv or cvc (src/Logger/RequestParamsRedactor.php:22, :25; called from ecommercen/audit/models/AdvAuditModel.php:111). This covers DELETE /rest/customer/me and POST /rest/customer/me/password. The one-time patcher patches/RedactAuditLogSecrets.php, run by migration database/migrations/20260929120000_redact_audit_log_secrets.php, masks rows already written.
Completeness enforcement
ErasureCoverage (src/Domains/Customer/Customer/Erasure/ErasureCoverage.php) lists the columns that link a row to a customer (LINK_COLUMNS, :23) and the customer-linked personal columns deliberately left as they are, each with a reason (RETAINED, :36-51). The Database-suite test tests/Integration/Domains/Customer/Customer/Erasure/CustomerErasureCoverageTest.php fails when a customer-linked personal column appears that no step claims and RETAINED does not justify.
Client extension rule
The client stub is application/modules/eshop/models/Sanitize_model.php. The old protected helpers of Adv_sanitize_model were removed, so overriding them has no effect. A client-only table or column holding customer data must become an ErasureStep (rebind CustomerErasure's $steps in the client container) or be justified in ErasureCoverage::RETAINED.
Client Extension Points
viewExtras()hook: Add custom data to account pages- Postal validation:
postalCheck[$country]callback per country - View templates: Override
{client_views}/customer/ - Account erasure: see "Client extension rule" under Account Deletion / Erasure above (an
ErasureStepor anErasureCoverage::RETAINEDentry, not anAdv_sanitize_modeloverride)
Legacy AJAX API
These endpoints are served by AdvApiCustomer (ecommercen/api/controllers/AdvApiCustomer.php) and provide customer self-service actions from the storefront. The controller extends Customer (requires customer session). Request bodies are JSON (parsed via jsonDecodeInputStream()) except getCustomerIsSignedUpViber which is GET.
Base path: /api/customer/{method} (routed via api/api_customer)
| Method | Path | Parameters | Auth | Response | Description |
|---|---|---|---|---|---|
| POST | /api/customer/addBirthDay | date (string, required, valid date) | Customer session | {} | Set or update the logged-in customer's birthdate |
| POST | /api/customer/setViberPhone | phone (string, required, valid mobile), addToViber (bool) | Customer session | {detail: string} | Sign up or remove the customer from Viber SMS marketing; if addToViber is truthy saves the phone number (idempotent atomic upsert — one row per (customer_id, provider_id), see #297), otherwise deletes the record |
| GET | /api/customer/getCustomerIsSignedUpViber | (none) | Customer session | {isSignedUpViber: bool} | Check whether the logged-in customer is signed up for Viber marketing; returns 401 if not logged in |
Error format: {error: {field: message}, statusCode: 400, statusMsg: "Bad Request"} for validation failures.
Migration note (velora#24 / ecommercen#296): setViberPhone and getCustomerIsSignedUpViber have full REST counterparts for headless/JWT consumers: POST /rest/customer/me/sms-marketing replaces the opt-in (addToViber=true) case, DELETE /rest/customer/me/sms-marketing/{providerId} replaces the opt-out (addToViber=false) case (idempotent), and GET /rest/customer/me/sms-marketing?filter[providerId]=1 replaces the boolean check (non-empty response = subscribed). The legacy endpoints remain active for session-based storefronts.
Known Issues & Security Gaps
setViberPhone()crashes on missing/invalid JSON body.AdvApiCustomer::setViberPhone()callsjsonDecodeInputStream()(returnsnullon empty or malformed JSON) and immediately accesses$data['addToViber']without a null guard (ecommercen/api/controllers/AdvApiCustomer.php:44-46). In PHP 8.1 this throws aTypeError("null is not an array") instead of returning a 400 validation response, resulting in an unhandled 500 for any request with a missing or malformed body.Storefront account deletion is a one-click GET with no confirmation and no password (#846).
Adv_customer::deleteUser()callssanitizeAccount()on the session customer and logs out, with no confirmation step and no password check (ecommercen/eshop/controllers/Adv_customer.php:1526-1531); the account page reaches it with a plain anchor tocustomer/deleteUser(application/views/main/layouts/customer/account.php:175). A single request to that URL from the signed-in session erases the account.DELETE /rest/customer/meby contrast requires the password (src/Rest/Customer/Controllers/Customer.php:408-411).The storefront action, the admin action, the guest job and the cron do not handle
ErasureFailed. OnlyCustomer::deleteMe()catches it (src/Rest/Customer/Controllers/Customer.php:430-435). The legacy callers (Adv_customer.php:1526-1531,Adv_customers_admin.php:347-352,AdvSanitizeGuestCustomers.php:20-33,Cronjob.php:398-409) let it propagate: the user or admin sees the error page instead of the redirect, and in the job and the cron the exception leaves the run. Nothing is half-deleted (the transaction is rolled back,CustomerErasure.php:99-109), but nothing reports the failure to the customer either. The job hands all selected ids to oneerase()call, so a single failure rolls back the whole batch (see SY-09 Customer Data Jobs).
Related Flows
- CF-10 Customer Auth — login/register
- CF-17 Wishlist — wishlist management
- CF-32 Loyalty Points — customer loyalty points balance
- AD-04 Customer Management — admin view and the admin delete action
- SY-09 Customer Data Jobs — the guest-sanitising job that runs the same erasure
- AD-52 Review Moderation — reviews that erasure deletes
- AD-33 Multi-Carrier Tracking — courier tracking integration
- IN-09 Transporter Integrations — courier API details
- IN-14 SMS Integrations — SMS provider infrastructure used for Viber/SMS dispatch