class Qiwi::Handler
Attributes
status[R]
txn[R]
Public Class Methods
call(txn, status)
click to toggle source
# File lib/qiwi/handler.rb, line 5 def self.call(txn, status) new(txn, status).handle end
new(txn, status)
click to toggle source
# File lib/qiwi/handler.rb, line 10 def initialize(txn, status) @txn = Transaction.new(txn) @status = status end
Public Instance Methods
check_transaction()
click to toggle source
# File lib/qiwi/handler.rb, line 19 def check_transaction unless txn.exists? logger.error "Transaction doesn't exist: #{txn.txn}" return 210 end if status != txn.remote_status logger.error "Stati don't match: #{txn.status} vs. #{status}" return 300 end unless txn.valid_amount? logger.error "Incorrect amount: #{txn.amount}" return 241 end if txn.valid? return 0 else logger.error "Unknown error: #{txn.inspect}" return 300 end ensure txn.commit! end
handle()
click to toggle source
# File lib/qiwi/handler.rb, line 15 def handle check_transaction end
logger()
click to toggle source
# File lib/qiwi/handler.rb, line 46 def logger Qiwi.logger end