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

[PW-2570] Complete refunds based on original PSP reference instead of the notification PSP reference #17

Closed
floorjubbega opened this issue Jul 31, 2020 · 0 comments

Comments

@floorjubbega
Copy link

Describe the bug

There can be cases when the refund fails. Example iDeal transaction:

  1. You start the payment, an offer is created
  2. You go back and open the app again, a new second offer is created
  3. As soon as you finish the payment the first offer is cancelled and an offer_closed notification is sent with a PSP reference.
  4. For the payment you get an Authorisation notification with another PSP reference. In some cases the offer_closed notification is going to be the "last" notification for the order and then the PSP reference will not match, therefore the refund cannot be done.

It would be preferable to store the original PSP reference for the order when the async notification from our server or the sync authorisation response from the API is processed. It appears the PSP reference is stored in the s_plugin_adyen_order_payment_info table, which can be used to fetch these details instead of the notification.

To Reproduce

Double check if s_plugin_adyen_order_payment_info db table is the best place to store the original PSP reference.

  • In case of sync authorisation response store the psp reference in the s_plugin_adyen_order_payment_info db table
  • In case of async authorisation notification if there is no PSP reference already stored in the s_plugin_adyen_order_payment_info db table, then store the original PSP reference. If it does not exist store the PSP reference field in the same db table.

Changes
Change the refund function

$notification = $this->notificationManager->getLastNotificationForOrderId($orderId);
to use the s_plugin_adyen_order_payment_info db table's psp reference instead of the notifications psp reference.

If the last notification has a different PSP reference than the original PSP reference the refund can still be done because it is using the s_plugin_adyen_order_payment_info table's psp reference.

@cyattilakiss cyattilakiss changed the title Complete refunds based on original PSP reference instead of the notification PSP reference [PW-2570] Complete refunds based on original PSP reference instead of the notification PSP reference Aug 4, 2020
runelaenen pushed a commit to runelaenen/adyen-shopware5 that referenced this issue Aug 28, 2020
runelaenen pushed a commit to runelaenen/adyen-shopware5 that referenced this issue Aug 28, 2020
acampos1916 added a commit that referenced this issue Sep 10, 2020
* [PW-2473]: Shopware review fixes and remove 3DS2 image size (#7)

* Shopware review fixes and remove 3DS2 image size

* Indentation fixes

* Hardcode 3DS image size

* Revert hardcode 3DS image size

* [PW-2562] Adjustments for phpcs (#9)

* Fixes and removing phpcs exclude patterns in favor of specific rules suppression

* New phpcs version and ignore/disable sniffs

* Adjusting copyright comment

* Update composer.json (#31)

To correctly install the plugin via composer, the module directory needs to be renamed to 'AdyenPayment'.

* Fix #19 PW-2601 Update completed state (#34)

* Fix #22 PW-2743 Show error on 404 (#35)

Shows error message when 404 is returned from Test button. This means the plugin is not active.

* PW-2603 remove customer id from shopperinfo payload (#33)

Co-authored-by: Wanne Van Camp <[email protected]>

* Fixing Yandex logo (#40)

* Improve exception logging (#37)

Fix #23 PW-2747

* Fixes #15 Handle offer_closed notification (#39)

* Fixes #15 Handle offer_closed notification

* PW-2748 Tabs -> spaces

* Fixes #18 PW-2600 Catch exception during backend Test (#38)

* Fixes #18 PW-2600 Catch exception during backend Test

* PW-2600 Tabs to spaces

* PW-2804 Save form before test (#36)

Saves the config before the test is ran.

Fix #24

* PW-2565 Make paymentsmethod cache configurable (#43)

Adds configuration option to make caching of /paymentmethods call configurable.

Co-authored-by: Ángel Campos <[email protected]>

Fixes #26

* PW-2505 Distinquish fields of test and live (#44)

* PW-2505 Distinquish fields of test and live

* PW-2505 Remove debug lines

* Improve labels

Co-authored-by: Ángel Campos <[email protected]>

Co-authored-by: Marcos Garcia <[email protected]>
Co-authored-by: Ángel Campos <[email protected]>

* Fixes #13 PW-2748 Add event to order restore (#42)

* Localizing changelog (#49)

* Feature/change refund function (#48)

* Save successful psp reference to PaymentInfo

* Fixes #17 Use succesfull notification for refunds

* Changing API test error code from 500 to 400 (#52)

* Fixing changelog

* 1.5.0 version bump

* Adding N/A to houseNumberOrName in Components/Payload/Providers/ShopperInfoProvider.php

Co-authored-by: maxwellpowers <[email protected]>
Co-authored-by: Rune Laenen <[email protected]>
Co-authored-by: Wanne Van Camp <[email protected]>
Co-authored-by: Wanne Van Camp <[email protected]>
Co-authored-by: Rune Laenen <[email protected]>
Co-authored-by: Marcos Garcia <[email protected]>
acampos1916 added a commit that referenced this issue Sep 30, 2020
* [PW-2473]: Shopware review fixes and remove 3DS2 image size (#7)

* Shopware review fixes and remove 3DS2 image size

* Indentation fixes

* Hardcode 3DS image size

* Revert hardcode 3DS image size

* [PW-2562] Adjustments for phpcs (#9)

* Fixes and removing phpcs exclude patterns in favor of specific rules suppression

* New phpcs version and ignore/disable sniffs

* Adjusting copyright comment

* Update composer.json (#31)

To correctly install the plugin via composer, the module directory needs to be renamed to 'AdyenPayment'.

* Fix #19 PW-2601 Update completed state (#34)

* Fix #22 PW-2743 Show error on 404 (#35)

Shows error message when 404 is returned from Test button. This means the plugin is not active.

* PW-2603 remove customer id from shopperinfo payload (#33)

Co-authored-by: Wanne Van Camp <[email protected]>

* Fixing Yandex logo (#40)

* Improve exception logging (#37)

Fix #23 PW-2747

* Fixes #15 Handle offer_closed notification (#39)

* Fixes #15 Handle offer_closed notification

* PW-2748 Tabs -> spaces

* Fixes #18 PW-2600 Catch exception during backend Test (#38)

* Fixes #18 PW-2600 Catch exception during backend Test

* PW-2600 Tabs to spaces

* PW-2804 Save form before test (#36)

Saves the config before the test is ran.

Fix #24

* PW-2565 Make paymentsmethod cache configurable (#43)

Adds configuration option to make caching of /paymentmethods call configurable.

Co-authored-by: Ángel Campos <[email protected]>

Fixes #26

* PW-2505 Distinquish fields of test and live (#44)

* PW-2505 Distinquish fields of test and live

* PW-2505 Remove debug lines

* Improve labels

Co-authored-by: Ángel Campos <[email protected]>

Co-authored-by: Marcos Garcia <[email protected]>
Co-authored-by: Ángel Campos <[email protected]>

* Fixes #13 PW-2748 Add event to order restore (#42)

* Localizing changelog (#49)

* Feature/change refund function (#48)

* Save successful psp reference to PaymentInfo

* Fixes #17 Use succesfull notification for refunds

* Changing API test error code from 500 to 400 (#52)

* Fixing changelog

* 1.5.0 version bump

* Adding N/A to houseNumberOrName in Components/Payload/Providers/ShopperInfoProvider.php

* Only send mail after succesful payment (#46)

* Only send mail after succesful payment

* Fixes #12 Tabs to spaces

* Fix indentation

* Fix indentation

Co-authored-by: Marcos Garcia <[email protected]>
Co-authored-by: Ángel Campos <[email protected]>

* #54 cronjobs not running (#55)

Add missing service registration

* add redirect  data to payments request (#56)

Co-authored-by: Wanne Van Camp <[email protected]>

* 1.5.1 changelog

Co-authored-by: maxwellpowers <[email protected]>
Co-authored-by: Rune Laenen <[email protected]>
Co-authored-by: Wanne Van Camp <[email protected]>
Co-authored-by: Wanne Van Camp <[email protected]>
Co-authored-by: Rune Laenen <[email protected]>
Co-authored-by: Marcos Garcia <[email protected]>
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

1 participant