Class: WirecardCheckoutPage::Toolkit::Request

Inherits:
Request
  • Object
show all
Defined in:
lib/wirecard_checkout_page/toolkit/request.rb

Direct Known Subclasses

RecurPayment

Constant Summary collapse

DEFAULT_URL =
'https://checkout.wirecard.com/page/toolkit.php'

Instance Attribute Summary

Attributes inherited from Request

#errors, #params, #url

Instance Method Summary collapse

Methods inherited from Request

#body, #fingerprint, #fingerprint_order, #fingerprint_string, #fingerprinted_request_params, param, params, params_order, #request_params, #valid?

Constructor Details

#initialize(url: nil, params: {}) ⇒ Request

Returns a new instance of Request.


30
31
32
33
# File 'lib/wirecard_checkout_page/toolkit/request.rb', line 30

def initialize(url: nil, params: {})
  super url: url || DEFAULT_URL, params: params
  self.language = 'en'
end

Instance Method Details

#callObject


35
36
37
38
# File 'lib/wirecard_checkout_page/toolkit/request.rb', line 35

def call
  raise WirecardCheckoutPage::ValueMissing, errors.join(', ') unless valid?
  WirecardCheckoutPage::Toolkit::Response.from_typhoeus_response Typhoeus.post(url, body: body, headers: headers)
end

#headersObject

HTTP header parameter Description Host Domain name of server. Has to be set to the following value: secure.wirecard-cee.com User-Agent User agent string of client. (Should be set by the HTTP-Client lib) Content-Length Length of body in bytes. (Should be set by HTTP-Client lib) Content-Type MIME type of the body. Has to be set to the following value: application/x-www-form-urlencoded Connection Type of connection. Has to be set to the following value: close


46
47
48
49
50
51
52
# File 'lib/wirecard_checkout_page/toolkit/request.rb', line 46

def headers
  {
    'Host'         => 'secure.wirecard-cee.com',
    'Content-Type' => 'application/x-www-form-urlencoded',
    'Connection'   => 'close',
  }
end