chore: import upstream snapshot with attribution
Workflow Lint / actionlint (push) Has been cancelled
Build CI Image / build (push) Has been cancelled
Skill Docs Freshness / check-freshness (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 11:59:46 +08:00
commit dfb0b33892
1170 changed files with 352893 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
# Feature branch version: adds "returned" status but misses consumers
class Order < ApplicationRecord
STATUSES = %w[pending processing shipped delivered returned].freeze
validates :status, inclusion: { in: STATUSES }
def display_status
case status
when 'pending' then 'Awaiting processing'
when 'processing' then 'Being prepared'
when 'shipped' then 'On the way'
when 'delivered' then 'Delivered'
# BUG: 'returned' not handled — falls through to nil
end
end
def can_cancel?
# BUG: should 'returned' be cancellable? Not considered.
%w[pending processing].include?(status)
end
def notify_customer
case status
when 'pending' then OrderMailer.confirmation(self).deliver_later
when 'shipped' then OrderMailer.shipped(self).deliver_later
when 'delivered' then OrderMailer.delivered(self).deliver_later
# BUG: 'returned' has no notification — customer won't know return was received
end
end
end