class Rubykassa::PaymentInterface
Constants
- PARAMS_CONFORMITY
Attributes
invoice_id[RW]
params[RW]
total[RW]
Public Class Methods
new(&block)
click to toggle source
# File lib/rubykassa/payment_interface.rb, line 20 def initialize &block instance_eval &block if block_given? shpfy_params end
Public Instance Methods
base_url()
click to toggle source
# File lib/rubykassa/payment_interface.rb, line 29 def base_url test_mode? ? "http://test.robokassa.ru/Index.aspx" : "https://merchant.roboxchange.com/Index.aspx" end
initial_options()
click to toggle source
# File lib/rubykassa/payment_interface.rb, line 45 def initial_options { login: Rubykassa.login, total: @total, invoice_id: @invoice_id, signature: generate_signature_for(:payment) }.merge(Hash[@params.sort.map {|param_name| [param_name[0], param_name[1]]}]) end
pay_url(extra_params = {})
click to toggle source
# File lib/rubykassa/payment_interface.rb, line 33 def pay_url(extra_params = {}) extra_params = extra_params.slice(:currency, :description, :email, :culture) "#{base_url}?" + initial_options.merge(extra_params).map do |key, value| if key =~ /^shp/ "#{key}=#{value}" else "#{PARAMS_CONFORMITY[key]}=#{value}" end end.compact.join("&") end
test_mode?()
click to toggle source
# File lib/rubykassa/payment_interface.rb, line 25 def test_mode? Rubykassa.mode == :test end
Private Instance Methods
shpfy_params()
click to toggle source
# File lib/rubykassa/payment_interface.rb, line 56 def shpfy_params @params = @params.map {|param_name| ["shp#{param_name[0]}".to_sym, param_name[1]]} end