Class: Liqpay::Request
- Inherits:
-
BaseOperation
- Object
- BaseOperation
- Liqpay::Request
- Defined in:
- lib/liqpay/request.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
REQUIRED Amount of payment (Float), in :currency.
-
#currency ⇒ Object
REQUIRED Currency of payment - one of ‘Liqpay::SUPPORTED_CURRENCIES`.
-
#description ⇒ Object
REQUIRED Description to be displayed to the user.
-
#language ⇒ Object
OPTIONAL UI language - ‘ru` or `en`.
-
#order_id ⇒ Object
RECOMMENDED Arbitrary but unique ID (May be REQUIRED by LiqPay configuration).
-
#result_url ⇒ Object
RECOMMENDED URL that the user will be redirected to after payment.
-
#server_url ⇒ Object
RECOMMENDED URL that’ll receive the order details in the background.
-
#type ⇒ Object
OPTIONAL type of payment = either ‘buy` (the default) or `donate`.
Attributes inherited from BaseOperation
Instance Method Summary collapse
- #form_fields ⇒ Object
-
#initialize(options = {}) ⇒ Request
constructor
A new instance of Request.
- #signature_fields ⇒ Object
Methods inherited from BaseOperation
Constructor Details
#initialize(options = {}) ⇒ Request
Returns a new instance of Request.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/liqpay/request.rb', line 23 def initialize(={}) super() @amount = [:amount] @currency = [:currency] @description = [:description] @order_id = [:order_id] @result_url = [:result_url] @server_url = [:server_url] @type = [:type] @language = [:language] @kamikaze = [:kamikaze] end |
Instance Attribute Details
#amount ⇒ Object
REQUIRED Amount of payment (Float), in :currency
7 8 9 |
# File 'lib/liqpay/request.rb', line 7 def amount @amount end |
#currency ⇒ Object
REQUIRED Currency of payment - one of ‘Liqpay::SUPPORTED_CURRENCIES`
9 10 11 |
# File 'lib/liqpay/request.rb', line 9 def currency @currency end |
#description ⇒ Object
REQUIRED Description to be displayed to the user
11 12 13 |
# File 'lib/liqpay/request.rb', line 11 def description @description end |
#language ⇒ Object
OPTIONAL UI language - ‘ru` or `en`
21 22 23 |
# File 'lib/liqpay/request.rb', line 21 def language @language end |
#order_id ⇒ Object
RECOMMENDED Arbitrary but unique ID (May be REQUIRED by LiqPay configuration)
13 14 15 |
# File 'lib/liqpay/request.rb', line 13 def order_id @order_id end |
#result_url ⇒ Object
RECOMMENDED URL that the user will be redirected to after payment
15 16 17 |
# File 'lib/liqpay/request.rb', line 15 def result_url @result_url end |
#server_url ⇒ Object
RECOMMENDED URL that’ll receive the order details in the background.
17 18 19 |
# File 'lib/liqpay/request.rb', line 17 def server_url @server_url end |
#type ⇒ Object
OPTIONAL type of payment = either ‘buy` (the default) or `donate`
19 20 21 |
# File 'lib/liqpay/request.rb', line 19 def type @type end |
Instance Method Details
#form_fields ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/liqpay/request.rb', line 41 def form_fields validate! unless @kamikaze { public_key: public_key, amount: amount, currency: currency, description: description, order_id: order_id, result_url: result_url, server_url: server_url, type: type, signature: signature, language: language }.reject{|k,v| v.nil?} end |
#signature_fields ⇒ Object
37 38 39 |
# File 'lib/liqpay/request.rb', line 37 def signature_fields [amount, currency, public_key, order_id, type, description, result_url, server_url] end |