Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip report notifications #111

Closed
wannevancamp opened this issue Jan 12, 2021 · 2 comments
Closed

Skip report notifications #111

wannevancamp opened this issue Jan 12, 2021 · 2 comments

Comments

@wannevancamp
Copy link
Contributor

wannevancamp commented Jan 12, 2021

Describe the bug
When an unsupported notification is send to the plugin there is no [accepted] in the response.
For example Report notifications

Fix in Shopware 6 plugin: https://github.com/Adyen/adyen-shopware6/blob/develop/src/Service/NotificationReceiverService.php#L271-L274

To Reproduce
Steps to reproduce the behavior:

  1. Adyen customer area send REPORT notification
  2. Plugin can't handle this type of notification
  3. Plugin returns [notification save error] instead of [accepted]
  4. Adyen customer area mentions that notifications are not accepted well.

Expected behavior
@acampos1916 , I'm not sure 100% about this:
When a notifications can't be handle correctly the plugin must catch the error and always return [accepted] instead of returning the error.

Currently there is validation for the 'existence of an order' when creating the notification and when processing the notification. The validation when creating a notification is not needed: https://github.com/Adyen/adyen-shopware5/blob/develop/Components/Builder/NotificationBuilder.php#L64-L68

@bortefi
Copy link
Contributor

bortefi commented Jan 14, 2021

[UPDATED]

@acampos1916

Currently the following responses are sent from calling /notification/adyen call:

  • '[Invalid or missing auth]' (failed auth)
  • '[wrong hmac detected]' (failed HMAC validation)
  • '[notification save error]' (issue during notification processing)
  • '[accepted]' (call was processed)

Since sending back a response something else than '[accepted]'would stop the Adyen notifications center,
Is it more prudent to treat it more like a webhook and always send '[accepted]' back when the call has been received?

According to the documentation: https://docs.adyen.com/development-resources/webhooks#accept-notifications
All notifications calls need to be answered with '[accepted]' within 10sec (or they are re-queued).
In case the Auth headers are invalid or the HMAC key is invalid, is there a response required as well?
(i'm thinking of cases where notification are sent from Adyen, but mismatch of Plugin configuration credentials

Current proposal:

  1. on failed authentication or HMAC: sent the error response
  2. in other cases send back '[accepted]'

The Shopware 6 plugin has responses:

  • failure: JSON array: return new JsonResponse(['success' => false, 'message' => $message]);
  • success: JSON string: new JsonResponse($acceptedMessage = '[accepted]');
    Should the SW 5 plugin reflect this as well?

@acampos1916
Copy link
Member

Hey @bortefi,

Coincidentally I'm taking a look at #81 which also touches up on this subject. Indeed all responses should return [accepted] if the authentications are valid. In that case your proposal is the desired way.

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

No branches or pull requests

3 participants