class Osm::OnlinePayment::Schedule::PaymentStatus
Constants
- VALID_STATUSES
Protected Class Methods
build_from_json(json, payment=nil)
click to toggle source
# File lib/osm/online_payment.rb, line 487 def self.build_from_json(json, payment=nil) data = ActiveSupport::JSON.decode(json) return [] unless data.is_a?(Hash) data = data['status'] return [] unless data.is_a?(Array) status_map = { 'Payment required' => :required, 'Payment not required' => :not_required, 'Initiated' => :initiated, 'Paid' => :paid, 'Received' => :received, 'Paid manually' => :paid_manually, } data.map! do |item| new( id: Osm::to_i_or_nil(item['statusid']), payment: payment, timestamp: Time.strptime(item['statustimestamp'], '%d/%m/%Y %H:%M'), status: status_map[item['status']], details: item['details'], updated_by: item['firstname'], updated_by_id: item['who'].to_i, ) end end
Public Instance Methods
<=>(another)
click to toggle source
# File lib/osm/online_payment.rb, line 475 def <=>(another) result = -(self.timestamp <=> another.try(:timestamp)) result = self.payment <=> another.try(:payment) if result.eql?(0) result = self.id <=> another.try(:id) if result.eql?(0) return result end
inspect()
click to toggle source
# File lib/osm/online_payment.rb, line 482 def inspect Osm.inspect_instance(self, {:replace_with => {'payment' => :id}}) end