Class: WirecardCheckoutPage::InitRequest

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

Constant Summary collapse

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

Instance Attribute Summary

Attributes inherited from Request

#errors, #params, #url

Instance Method Summary collapse

Methods inherited from Request

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

Constructor Details

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

Returns a new instance of InitRequest.


6
7
8
9
# File 'lib/wirecard_checkout_page/init_request.rb', line 6

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

Instance Method Details

#callObject


65
66
67
68
# File 'lib/wirecard_checkout_page/init_request.rb', line 65

def call
  raise WirecardCheckoutPage::ValueMissing, errors.join(', ') unless valid?
  InitResponse.from_typhoeus_response Typhoeus.post(DEFAULT_URL, body: body)
end

#fingerprint_orderObject


57
58
59
# File 'lib/wirecard_checkout_page/init_request.rb', line 57

def fingerprint_order
  super + [:requestFingerprintOrder]
end

#requestFingerprintOrderObject


61
62
63
# File 'lib/wirecard_checkout_page/init_request.rb', line 61

def requestFingerprintOrder
  fingerprint_order * ','
end