Class: Payonline::PaymentGateway

Inherits:
Object
  • Object
show all
Defined in:
lib/payonline/payment_gateway.rb

Constant Summary collapse

BASE_URL =
'https://secure.payonlinesystem.com'
SIGNED_PARAMS =
%w(order_id amount currency valid_until order_description)
PERMITTED_PARAMS =
%w(
  order_id amount currency valid_until order_description return_url fail_url
)
PAYMENT_TYPE_URL =
{
  qiwi: 'select/qiwi/',
  webmoney: 'select/webmoney/',
  yandexmoney: 'select/yandexmoney/',
  masterpass: 'select/masterpass/'
}

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ PaymentGateway

Returns a new instance of PaymentGateway.



17
18
19
# File 'lib/payonline/payment_gateway.rb', line 17

def initialize(params = {})
  @params = prepare_params(params)
end

Instance Method Details

#payment_url(type: :card, language: :ru) ⇒ Object



21
22
23
24
25
# File 'lib/payonline/payment_gateway.rb', line 21

def payment_url(type: :card, language: :ru)
  params = Payonline::Signature.new(@params, SIGNED_PARAMS).sign

  "#{BASE_URL}/#{language}/payment/#{PAYMENT_TYPE_URL[type]}?#{params.to_query}"
end