21 lines
379 B
Ruby
21 lines
379 B
Ruby
class Zap < ApplicationRecord
|
|
belongs_to :user
|
|
|
|
scope :settled, -> { where.not(settled_at: nil) }
|
|
scope :unpaid, -> { where(settled_at: nil) }
|
|
|
|
def request_event
|
|
nostr_event_from_hash(request)
|
|
end
|
|
|
|
def receipt_event
|
|
nostr_event_from_hash(receipt)
|
|
end
|
|
|
|
private
|
|
|
|
def nostr_event_from_hash(hash)
|
|
Nostr::Event.new(**hash.symbolize_keys)
|
|
end
|
|
end
|