- Make sale update transaction atomic by wrapping sale row update,
payment processing, and reward point adjustments in a single transaction
- Fix customer_id fallback bug: use array_key_exists instead of null
coalesce to preserve previous customer when customer_id is omitted
- Prevent double-crediting on delete: only restore reward points when
sale_status is not already CANCELED
- Remove sensitive payment data from debug logs: replace json_encode
with aggregated values (count and totals)