Class: WirecardCheckoutPage::Gateway

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

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(customerId: nil, secret: nil, init_url: nil) ⇒ Gateway

Returns a new instance of Gateway.



7
8
9
10
11
# File 'lib/wirecard_checkout_page/gateway.rb', line 7

def initialize(customerId: nil, secret: nil, init_url: nil)
  @customerId = customerId
  @secret     = secret
  @init_url   = init_url || DEFAULT_INIT_URL
end

Instance Attribute Details

#customerIdObject

Returns the value of attribute customerId.



5
6
7
# File 'lib/wirecard_checkout_page/gateway.rb', line 5

def customerId
  @customerId
end

#init_urlObject

Returns the value of attribute init_url.



5
6
7
# File 'lib/wirecard_checkout_page/gateway.rb', line 5

def init_url
  @init_url
end

#secretObject

Returns the value of attribute secret.



5
6
7
# File 'lib/wirecard_checkout_page/gateway.rb', line 5

def secret
  @secret
end

Instance Method Details

#check_response(params = {}) ⇒ Object



18
19
20
21
22
# File 'lib/wirecard_checkout_page/gateway.rb', line 18

def check_response(params = {})
  WirecardCheckoutPage::CheckedResponse.new(
    params.merge(authentication_params)
  )
end

#init(params = {}) ⇒ Object



13
14
15
16
# File 'lib/wirecard_checkout_page/gateway.rb', line 13

def init(params = {})
  checksum = WirecardCheckoutPage::RequestChecksum.new(params.merge(authentication_params))
  InitResponse.new Typhoeus.post(init_url, body: checksum.request_parameters)
end