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

#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

#response_valid?(params = {}) ⇒ Boolean

Returns:

  • (Boolean)


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

def response_valid?(params = {})
  WirecardCheckoutPage::ResponseChecksum.new(params.merge(authentication_params)).valid?
end