Class: ActiveMerchant::Billing::PayuInGateway

Inherits:
Gateway
  • Object
show all
Defined in:
app/models/payu_in_gateway.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PayuInGateway

Returns a new instance of PayuInGateway.



7
8
9
10
11
# File 'app/models/payu_in_gateway.rb', line 7

def initialize(options = {})
  requires!(options, :merchant_id, :salt)
  @options = options
  super
end

Instance Method Details

#authorize(money, creditcard, options = {}) ⇒ Object



41
42
# File 'app/models/payu_in_gateway.rb', line 41

def authorize(money, creditcard, options = {})
end

#capture(money, authorization, options = {}) ⇒ Object



44
45
# File 'app/models/payu_in_gateway.rb', line 44

def capture(money, authorization, options= {})
end

#credit(money, identification, options = {}) ⇒ Object



50
51
# File 'app/models/payu_in_gateway.rb', line 50

def credit(money, identification, options = {})
end

#hash(order, payment_method_id) ⇒ Object



21
22
23
24
25
26
27
# File 'app/models/payu_in_gateway.rb', line 21

def hash(order, payment_method_id)
  if Rails.env.production? || Rails.env.staging?
    Digest::SHA512.hexdigest("#{self.merchant_id}|#{order.id}|#{order.total.to_f}|#{order.number}|#{order.bill_address.firstname}|#{order.user.email}|#{payment_method_id}||||||||||#{self.salt}")
  else
    Digest::SHA512.hexdigest("#{self.merchant_id}|#{order.id}|#{order.total.to_i}|#{order.number}|#{order.bill_address.firstname}|#{order.user.email}|#{payment_method_id}||||||||||#{self.salt}")
  end  
end

#merchant_idObject



13
14
15
# File 'app/models/payu_in_gateway.rb', line 13

def merchant_id
  @options[:merchant_id]
end

#purchase(money, creditcard, options = {}) ⇒ Object

Methods suggested to be supported by active_merchant github.com/Shopify/active_merchant/blob/master/lib/active_merchant/billing/gateway.rb

purchase(money, creditcard, options = {}) authorize(money, creditcard, options = {}) capture(money, authorization, options = {}) void(identification, options = {}) credit(money, identification, options = {})



38
39
# File 'app/models/payu_in_gateway.rb', line 38

def purchase(money, creditcard, options = {})
end

#saltObject



17
18
19
# File 'app/models/payu_in_gateway.rb', line 17

def salt
  @options[:salt]
end

#void(identification, options = {}) ⇒ Object



47
48
# File 'app/models/payu_in_gateway.rb', line 47

def void(identification, options= {})
end