# frozen_string_literal: true module StrikeMe module API class Invoices # Response of POST invoices/{id}/quote — the actual payable BOLT 11 # only exists once a quote is issued; Invoice#create alone reserves # the invoice shell but has nothing a wallet can pay yet. class Quote < BaseModel attribute :quoteId attribute :description attribute :lnInvoice attribute :onchainAddress attribute :expiration, :datetime attribute :expirationInSec, :integer attribute :targetAmount attribute :sourceAmount attribute :conversionRate alias_attribute :id, :quoteId alias_attribute :bolt11, :lnInvoice attribute_names.select { _1.end_with? 'Id' }.each do |snake_name| alias_attribute snake_name.underscore, snake_name end def expired? expiration.present? && expiration.past? end end end end end