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-4139 Hide Adyen payment methods for 0 amount transactions #146

Merged
merged 6 commits into from
Mar 1, 2021

Conversation

peterojo
Copy link
Contributor

Summary

From issue #139
This PR hides Adyen payment methods when the total amount in the basket is 0.
Resets the selected payment method to the shopware5 default when the amount has changed, e.g after applying a voucher.

Tested scenarios

Pay for item that costs nothing
Apply voucher that sets total price to 0

Fixed issue: #139

@@ -52,6 +52,8 @@
var me = this;
if (!$.isEmptyObject(me.opts.adyenSetSession)) {
me.sessionStorage.setItem(me.paymentMethodSession, JSON.stringify(me.opts.adyenSetSession));
} else {
me.sessionStorage.removeItem(me.paymentMethodSession);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary to clear the sessionStorage data when it is not sent from the backend, otherwise this widget might still attempt to pay with Adyen (in onPlaceOrder) and fail.

{
/** @var Shopware_Controllers_Frontend_Checkout $subject */
$subject = $args->getSubject();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of re-declaring the $subject in all these methods, just pass it through

@peterojo peterojo merged commit e056a81 into develop Mar 1, 2021
@peterojo peterojo deleted the PW-4139 branch March 1, 2021 09:46
@acampos1916 acampos1916 mentioned this pull request Mar 26, 2021
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.

Hide Adyen payment methods for 0 amount transactions.
3 participants