Skip to content

Conversation

@sndrgrdn
Copy link
Contributor

@sndrgrdn sndrgrdn commented Dec 2, 2019

This will add functionality to verify HMAC signatures from the webhooks that are received.

There are specs available for this new behaviour.

@crrood
Copy link
Contributor

crrood commented Dec 3, 2019

Hi Sander,

Thanks for adding this functionality, it looks good to me.

Have you tested it in the sandbox environment, using a real-time HMAC signature?

Best,
Colin

@sndrgrdn
Copy link
Contributor Author

sndrgrdn commented Dec 4, 2019

Have you tested it in the sandbox environment, using a real-time HMAC signature?

I'm currently implementing Adyen into our webshop and needed it to verify webhooks. so yes this is being testing in the sandbox environment with real-time HMAC signatures :)

To give an example how it is being used in a Rails project, I included a snippet below:

hmac_key = 'YOUR_HMAC_KEY'
validator = Adyen::Utils::HmacValidator.new

params['notificationItems'].each do |notification_item|
  request_item = notification_item['NotificationRequestItem']
  next unless validator.validate(request_item, hmac_key)

  # Call some worker or other business logic here
end

render :text => '[accepted]'

@crrood
Copy link
Contributor

crrood commented Dec 4, 2019

Hi Sander,

Okay, sounds good - I've approved the PR, just need one of my colleagues to approve as well and we'll merge it.

Best,
Colin

@crrood crrood requested a review from hbkwong December 4, 2019 22:58
@rikterbeek
Copy link
Contributor

Hi @sndrgrdn,

Many thanks for this PR!. Definitely we wanted to add so great that you have done a PR for this.
As we are wanting to make this feature similar across all libraries could you adjust the naming of the methods ? For the rest it looks great :)

Regards,
Rik
Adyen

@sndrgrdn sndrgrdn requested a review from rikterbeek December 6, 2019 09:44
@crrood crrood merged commit 231f79a into Adyen:develop Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants