Class: SpreeAdyen::Webhooks::StandardHmacValidator

Inherits:
Object
  • Object
show all
Defined in:
app/services/spree_adyen/webhooks/standard_hmac_validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(request:, params:, gateway:) ⇒ StandardHmacValidator

Returns a new instance of StandardHmacValidator.



4
5
6
7
8
# File 'app/services/spree_adyen/webhooks/standard_hmac_validator.rb', line 4

def initialize(request:, params:, gateway:)
  @request = request
  @params = params
  @gateway = gateway
end

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
# File 'app/services/spree_adyen/webhooks/standard_hmac_validator.rb', line 10

def call
  return false if gateway.nil?

  hmac_keys.any? do |hmac_key|
    Adyen::Utils::HmacValidator.new.valid_webhook_hmac?(
      webhook_request_item,
      hmac_key
    )
  end
end