Class: UnifiedPayment::Transaction

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Utility
Defined in:
app/models/unified_payment/transaction.rb

Class Method Summary collapse

Methods included from Utility

#approved_at_gateway?

Class Method Details

.create_order_at_unified(amount, options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/unified_payment/transaction.rb', line 6

def self.create_order_at_unified(amount, options)
  3.times do |attempt|
    begin
      @response = Client.create_order((amount.to_f)*100, options)
      create(:url => @response['url'], :gateway_order_id => @response['orderId'], :gateway_session_id => @response['sessionId'], :xml_response => @response['xml_response'].to_s)
      break
    rescue
      @response = false
    end
  end
  @response
end

.extract_url_for_unified_payment(response) ⇒ Object



19
20
21
# File 'app/models/unified_payment/transaction.rb', line 19

def self.extract_url_for_unified_payment(response)
  response['url'] + '?' + 'ORDERID=' + response['orderId'] + '&' + 'SESSIONID=' + response['sessionId']
end