Class: Payu::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/payu/transaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Transaction

Returns a new instance of Transaction.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/payu/transaction.rb', line 11

def initialize(options = {})
  options[:session_id] ||= Timestamp.generate

  options.each do |name, value|
    send("#{name.to_s}=", value)
  end

  validate!

  if options[:add_signature]
    self.ts = Timestamp.generate
    self.sig = generate_signature
  end

  if variant == 'sms'
    self.amount_netto = amount
    self.amount = nil
  end
end

Instance Attribute Details

#add_signatureObject

Returns the value of attribute add_signature.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def add_signature
  @add_signature
end

#amountObject

Returns the value of attribute amount.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def amount
  @amount
end

#amount_nettoObject

Returns the value of attribute amount_netto.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def amount_netto
  @amount_netto
end

#cityObject

Returns the value of attribute city.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def city
  @city
end

#client_ipObject

Returns the value of attribute client_ip.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def client_ip
  @client_ip
end

#countryObject

Returns the value of attribute country.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def country
  @country
end

#descObject

Returns the value of attribute desc.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def desc
  @desc
end

#desc2Object

Returns the value of attribute desc2.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def desc2
  @desc2
end

#emailObject

Returns the value of attribute email.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def email
  @email
end

#encodingObject

Returns the value of attribute encoding.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def encoding
  @encoding
end

#first_nameObject

Returns the value of attribute first_name.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def first_name
  @first_name
end

#gateway_urlObject

Returns the value of attribute gateway_url.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def gateway_url
  @gateway_url
end

#jsObject

Returns the value of attribute js.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def js
  @js
end

#key1Object

Returns the value of attribute key1.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def key1
  @key1
end

#languageObject

Returns the value of attribute language.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def language
  @language
end

#last_nameObject

Returns the value of attribute last_name.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def last_name
  @last_name
end

#order_idObject

Returns the value of attribute order_id.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def order_id
  @order_id
end

#pay_typeObject

Returns the value of attribute pay_type.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def pay_type
  @pay_type
end

#payback_loginObject

Returns the value of attribute payback_login.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def 
  @payback_login
end

#phoneObject

Returns the value of attribute phone.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def phone
  @phone
end

#pos_auth_keyObject

Returns the value of attribute pos_auth_key.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def pos_auth_key
  @pos_auth_key
end

#pos_idObject

Returns the value of attribute pos_id.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def pos_id
  @pos_id
end

#post_codeObject

Returns the value of attribute post_code.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def post_code
  @post_code
end

#session_idObject

Returns the value of attribute session_id.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def session_id
  @session_id
end

#sigObject

Returns the value of attribute sig.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def sig
  @sig
end

#streetObject

Returns the value of attribute street.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def street
  @street
end

#street_anObject

Returns the value of attribute street_an.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def street_an
  @street_an
end

#street_hnObject

Returns the value of attribute street_hn.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def street_hn
  @street_hn
end

#trsDescObject

Returns the value of attribute trsDesc.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def trsDesc
  @trsDesc
end

#tsObject

Returns the value of attribute ts.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def ts
  @ts
end

#variantObject

Returns the value of attribute variant.



5
6
7
# File 'lib/payu/transaction.rb', line 5

def variant
  @variant
end

Instance Method Details

#new_urlObject



31
32
33
34
35
36
37
# File 'lib/payu/transaction.rb', line 31

def new_url
  if variant == 'sms'
    return "https://#{gateway_url}/paygw/#{encoding}/NewSMS"
  else
    return "https://#{gateway_url}/paygw/#{encoding}/NewPayment"
  end
end