Class: OmniKassa::Request
- Inherits:
-
Object
- Object
- OmniKassa::Request
- Defined in:
- lib/omni_kassa/request.rb
Defined Under Namespace
Classes: RequestError
Constant Summary collapse
- KEY_VERSION =
OmniKassa requirement, doesn’t do anything
1- INTERFACE_VERSION =
OmniKassa requirement, doesn’t do anything
'HP_1.0'- REQUIRED =
:merchant_id, :currency_code, :transaction_reference, :order_id, :amount, :normal_return_url, :key_version, :automatic_response_url, :customer_language
- OPTIONAL =
:payment_mean_brand_list, :customer_language, :expiration_date
Instance Method Summary collapse
-
#initialize ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Object
- #query ⇒ Object
- #transaction_reference ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Request
17 18 19 20 21 22 23 24 |
# File 'lib/omni_kassa/request.rb', line 17 def initialize self.key_version = KEY_VERSION # Load default settings into the request OmniKassa.request_settings.each do |key, value| send key.to_s + '=', value end end |
Instance Method Details
#perform ⇒ Object
33 34 35 36 |
# File 'lib/omni_kassa/request.rb', line 33 def perform # SSLv3 is a TravisCI requirement; won't run otherwise HTTParty.post(OmniKassa.url, query: query, ssl_version: :SSLv3).body end |
#query ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/omni_kassa/request.rb', line 42 def query { InterfaceVersion: INTERFACE_VERSION, Data: data, Seal: seal } end |
#transaction_reference ⇒ Object
38 39 40 |
# File 'lib/omni_kassa/request.rb', line 38 def transaction_reference @transaction_reference.call(order_id) end |
#valid? ⇒ Boolean
26 27 28 29 30 31 |
# File 'lib/omni_kassa/request.rb', line 26 def valid? REQUIRED.map do |attr| value = send attr return false if value.nil? end end |