Adyen / adyen-shopware5

MIT License
11 stars 12 forks source link

After installing Version 3.1.0 Dependencies Error in Backend #192

Closed webtech-tom closed 2 years ago

webtech-tom commented 2 years ago

Describe the bug After installing AdyenPayment Plugin Version 3.1.0 and logging in to the backend of Shopware, an error occurs.

Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The "adyen_payment.components.notification_manager" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead. in /var/www/clients/client1/web2/web/staging/vendor/symfony/dependency-injection/Container.php:275

To Reproduce Steps to reproduce the behavior:

  1. Install Shopware Version 5.7.0
  2. Install Plugin Version 3.1.0
  3. Delete Cache
  4. Log in to the Shopware backend

Expected behavior Logging in to the Shopware backend without dependency error.

Screenshots Error after logging in the Shopware backend

backend_error

Desktop (please complete the following information):

Additional context Shopware: 5.7.0 PHP: 7.4 Adyen 3.1.0

To fix this problem I made all services public in the components.xml and managers.xml of the Adyen Plugin: <defaults public="true" /> The backend error window doesn't show up When I go to the Adyen Plugin Configuration Window, no configuration fields appear image

ghost commented 2 years ago

Hi Tom,

Unfortunately the latest version of the plugin is only compatible with 5.7.3 and above. I recommend you to upgrade the platform. Thanks!

webtech-tom commented 2 years ago

Hi Suzell, Thank you very much for the reply. I updated to Shopware Version 5.7.3 and also reinstalled Adyen 3.1.0. When I go to the checkout the following error accurs:

Fatal error: Uncaught Error: Class 'Adyen\Service\Checkout' not found in .../staging/custom/plugins/AdyenPayment/Components/Adyen/PaymentMethodService.php:134

ghost commented 2 years ago

@bortefi Can you help here?

NilsVankan commented 2 years ago

Hey @webtech-tom we made a small change in the current zip file of the install and if you redownload and reinstall the plugin the error shouldn't accur.

Kind regards

webtech-tom commented 2 years ago

Hi @NilsVankan , Thanks a lot for the fast reply. I cloned "https://github.com/Adyen/adyen-shopware5.git" and ran composer etc. Now, when I go to the checkout this error accurs:

Fatal error: Uncaught TypeError: Argument 1 passed to AdyenPayment\Collection\Payment\PaymentMethodCollection::fetchByTypeOrId() must be of the type string, null given, called in ...AdyenPayment/Collection/Payment/PaymentMeanCollection.php on line 114

bortefi commented 2 years ago

Hello @webtech-tom

Which branch did you use from Github (advised is to use a tag). Did you also reinstall the plugin through cli of shopware and clear the cache of Shopware?

webtech-tom commented 2 years ago

Hi @bortefi , I used the 3.1.0. tag. I fully uninstalled the plugin and the reinstalled the 3.1.0. tag version again.

Now the error is gone, but I can not choose one of the "old" payment methods I configured before I imported the Adyen payment methods. If I choose one of the "old" payment methods I can not go to the next step in the checkout. And this code appears in the checkout:

image

<\/a> Bezahlung per PayPal - einfach, schnell und sicher.","debit_percent":"0","surcharge":"0","surchargestring":"","position":"1","active":"1","esdactive":"0","embediframe":"","hideprospect":"0","action":"PaypalUnified","pluginID":null,"source":null,"mobile_inactive":"0","attributes":{"core":{"id":"1","paymentmeanID":"64","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":"","adyen_type":null,"adyen_stored_method_id":null}},"attribute":{"id":"1","paymentmeanID":"64","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":"","adyen_type":null,"adyen_stored_method_id":null}},"59":{"id":"59","name":"amazon_pay","description":"Amazon Pay","template":"","class":"","table":"","hide":"0","additionaldescription":"\n Schnell und einfach einkaufen und dazu die in Ihrem Amazon-Kundenkonto hinterlegten Informationen nutzen.\nBezahlen Sie sicher, ohne Ihre Versand- und Zahlungsinformationen erneut einzugeben. Sie sind durch die A- bis z-Garantie gesch\u00fctzt - wie beim Einkauf auf Amazon.<\/p>","debit_percent":"0","surcharge":"0","surchargestring":"","position":"2","active":"1","esdactive":"0","embediframe":"","hideprospect":"0","action":"AmazonPay","pluginID":"107","source":null,"mobile_inactive":"0","attributes":{"core":{"id":"3","paymentmeanID":"59","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":"","adyen_type":null,"adyen_stored_method_id":null}},"attribute":{"id":"3","paymentmeanID":"59","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":"","adyen_type":null,"adyen_stored_method_id":null}},"4":{"id":"4","name":"invoice","description":"Kauf auf Rechnung","template":"invoice.tpl","class":"invoice.php","table":"","hide":"0","additionaldescription":"\n Universit\u00e4ten, Hochschulen, Institute, sowie Unternehmen gew\u00e4hren wir die Lieferung auf Rechnung. Das Zahlungsziel betr\u00e4gt 10 Tage ab Rechnungsdatum. <\/p>","debit_percent":"0","surcharge":"0","surchargestring":"","position":"8","active":"1","esdactive":"0","embediframe":"","hideprospect":"0","action":"","pluginID":null,"source":null,"mobile_inactive":"0","attributes":{"core":{"id":"8","paymentmeanID":"4","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":"","adyen_type":null,"adyen_stored_method_id":null}},"attribute":{"id":"8","paymentmeanID":"4","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":"","adyen_type":null,"adyen_stored_method_id":null}}}' data-adyensnippets="{"updatePaymentInformation":"Aktualisieren Sie bitte Ihre Zahlungsinformationen","storedPaymentMethodTitle":"Stored payment methods","paymentMethodTitle":"Zahlungsm\u00f6glichkeiten"}" class="adyen-payment-selection adyen-config">

bortefi commented 2 years ago

Hello @webtech-tom

The "old" payment methods, you mean by these the default installed by Shopware or manually added payment methods?

By the dump it looks like the JSON contains html characters, that cause the view to break.

I've added a specific branch for this case: release-3.1.0-192

webtech-tom commented 2 years ago

Hello @bortefi ,

Yes by "old" payment methods I mean the default installed payment methods plus AmazonPay and Paypal. image

The branch "release-3.1.0-192" fixes the JSON content.

But now there is the following problem:

  1. If I choose f.e. Paypal as the payment method in the checkout, then I can not go on to the last checkout page. Everytime I click on "Next"-Button I've got redirected to the checkout page where I have to choose a payment method.
  2. If I choose AliPay or credit card, then my order goes through without redirect to the alipay site or the credit card modal. The order is immediately confirmed and the checkout/finish page shows up.

Thank you very much @bortefi !

bortefi commented 2 years ago

@webtech-tom

If I'm correct, the PayPal method used is the default Shopware method and the AliPay and credit card option is one of Adyen?

This last issue seems to be due to the fact that the Adyen web components library might not be loaded correctly. Could you remove web/cache/[compiled].js and verify after reloading that the library ...checkoutshopper/sdk/4.1.0/adyen.js is loaded in the view?

webtech-tom commented 2 years ago

@bortefi

Yes you are correct, the PayPal method is from the PayPal Shopware Plugin and the AliPay and credit card option are from the imported Adyen payment methods.

Yes the adyen.js is loaded image

bortefi commented 2 years ago

@webtech-tom thx for the feedback, this issue needs a closer look. I will inform you when we have found the cause of this behaviour

webtech-tom commented 2 years ago

@bortefi Thank you for your help. Could you find the cause of this behaviour?

bortefi commented 2 years ago

Hello @webtech-tom We have identified the issue and are preparing a new release 3.1.1 / 3.2.0 These will follow soon, to fix this issue amongst others.

webtech-tom commented 2 years ago

@bortefi Thanks a lot!

webtech-tom commented 2 years ago

Hi @bortefi , Thank you very much for the reply. We tested the 3.2.0 version. Unfortunately in the checkout step, where I have to choose the payment method, an JS-error occurs (see below) and no payment methods will show up:

Uncaught TypeError: me.opts.enrichedPaymentMethods.filter is not a function at Plugin.handleApplePayVisibility (1641307142_70940d0c7b2605cab49eb94d1390f323.js:800) at Plugin.enableVisibility (1641307142_70940d0c7b2605cab49eb94d1390f323.js:799) at Plugin.init (1641307142_70940d0c7b2605cab49eb94d1390f323.js:799) at PluginBase (1641307142_70940d0c7b2605cab49eb94d1390f323.js:144) at new Plugin (1641307142_70940d0c7b2605cab49eb94d1390f323.js:152) at HTMLDivElement. (1641307142_70940d0c7b2605cab49eb94d1390f323.js:152) at Function.each (1641307142_70940d0c7b2605cab49eb94d1390f323.js:5) at S.fn.init.each (1641307142_70940d0c7b2605cab49eb94d1390f323.js:5) at S.fn.init.pluginFn [as adyen-payment-selection] (1641307142_70940d0c7b2605cab49eb94d1390f323.js:152) at EventEmitter._initSinglePlugin (1641307142_70940d0c7b2605cab49eb94d1390f323.js:193)

image

bortefi commented 2 years ago

Hi @webtech-tom

When installing version 3.2.0 have you re-imported the payment methods of Adyen in the Admin? Version 3.2.0 has some additions to the import process.

If the error still occurs, Is it possible to show a console log of me.opts.enrichedPaymentMethods?

webtech-tom commented 2 years ago

@bortefi Yes I also deleted Adyen Plugin completely (with that all imported payment methods). After that I reinstalled the version 3.2.0 and reimported the payment methods. Unfortunately I get a referenceError when I try to console log me.opts.enrichedPaymentMethods.

webtech-tom commented 2 years ago

But here is the html data attribute "data-enrichedpaymentmethods": [{"id":"174","name":"alipay_alipay","description":"AliPay","template":"","class":"","table":"","hide":"0","additionaldescription":"","debit_percent":"0","surcharge":"0","surchargestring":"","position":"0","active":"1","esdactive":"0","embediframe":"","hideprospect":"0","action":null,"pluginID":"134","source":"1425514","mobile_inactive":"0","attributes":{"core":{"id":"115","paymentmeanID":"174","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"alipay_alipay","adyen_stored_method_id":""}},"attribute":{"id":"115","paymentmeanID":"174","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"alipay_alipay","adyen_stored_method_id":""},"enriched":true,"image":"https:\/\/checkoutshopper-live.adyen.com\/checkoutshopper\/images\/logos\/alipay.svg","isStoredPayment":false,"isAdyenPaymentMethod":true,"adyenType":"alipay","metadata":{"name":"AliPay","type":"alipay"}},{"id":"177","name":"directebanking_online_bank_transfer","description":"Online bank transfer.","template":"","class":"","table":"","hide":"0","additionaldescription":"","debit_percent":"0","surcharge":"0","surchargestring":"","position":"0","active":"1","esdactive":"0","embediframe":"","hideprospect":"0","action":null,"pluginID":"134","source":"1425514","mobile_inactive":"0","attributes":{"core":{"id":"118","paymentmeanID":"177","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"directebanking_online_bank_transfer","adyen_stored_method_id":""}},"attribute":{"id":"118","paymentmeanID":"177","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"directebanking_online_bank_transfer","adyen_stored_method_id":""},"enriched":true,"image":"https:\/\/checkoutshopper-live.adyen.com\/checkoutshopper\/images\/logos\/directEbanking.svg","isStoredPayment":false,"isAdyenPaymentMethod":true,"adyenType":"directEbanking","metadata":{"name":"Sofort.","type":"directEbanking"}},{"id":"181","name":"giropay_giropay","description":"GiroPay","template":"","class":"","table":"","hide":"0","additionaldescription":"","debit_percent":"0","surcharge":"0","surchargestring":"","position":"0","active":"1","esdactive":"0","embediframe":"","hideprospect":"0","action":null,"pluginID":"134","source":"1425514","mobile_inactive":"0","attributes":{"core":{"id":"122","paymentmeanID":"181","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"giropay_giropay","adyen_stored_method_id":""}},"attribute":{"id":"122","paymentmeanID":"181","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"giropay_giropay","adyen_stored_method_id":""},"enriched":true,"image":"https:\/\/checkoutshopper-live.adyen.com\/checkoutshopper\/images\/logos\/giropay.svg","isStoredPayment":false,"isAdyenPaymentMethod":true,"adyenType":"giropay","metadata":{"name":"GiroPay","type":"giropay"}},{"id":"184","name":"klarna_account_pay_over_time_with_klarna","description":"Pay over time with Klarna.","template":"","class":"","table":"","hide":"0","additionaldescription":"","debit_percent":"0","surcharge":"0","surchargestring":"","position":"0","active":"1","esdactive":"0","embediframe":"","hideprospect":"0","action":null,"pluginID":"134","source":"1425514","mobile_inactive":"0","attributes":{"core":{"id":"125","paymentmeanID":"184","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"klarna_account_pay_over_time_with_klarna","adyen_stored_method_id":""}},"attribute":{"id":"125","paymentmeanID":"184","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"klarna_account_pay_over_time_with_klarna","adyen_stored_method_id":""},"enriched":true,"image":"https:\/\/checkoutshopper-live.adyen.com\/checkoutshopper\/images\/logos\/klarna_account.svg","isStoredPayment":false,"isAdyenPaymentMethod":true,"adyenType":"klarna_account","metadata":{"name":"Ratenkauf mit Klarna.","type":"klarna_account"}},{"id":"183","name":"klarna_pay_later_with_klarna","description":"Pay later with Klarna.","template":"","class":"","table":"","hide":"0","additionaldescription":"","debit_percent":"0","surcharge":"0","surchargestring":"","position":"0","active":"1","esdactive":"0","embediframe":"","hideprospect":"0","action":null,"pluginID":"134","source":"1425514","mobile_inactive":"0","attributes":{"core":{"id":"124","paymentmeanID":"183","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"klarna_pay_later_with_klarna","adyen_stored_method_id":""}},"attribute":{"id":"124","paymentmeanID":"183","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"klarna_pay_later_with_klarna","adyen_stored_method_id":""},"enriched":true,"image":"https:\/\/checkoutshopper-live.adyen.com\/checkoutshopper\/images\/logos\/klarna.svg","isStoredPayment":false,"isAdyenPaymentMethod":true,"adyenType":"klarna","metadata":{"name":"Rechnung mit Klarna.","type":"klarna"}},{"id":"185","name":"klarna_paynow_pay_now_with_klarna","description":"Pay now with Klarna.","template":"","class":"","table":"","hide":"0","additionaldescription":"","debit_percent":"0","surcharge":"0","surchargestring":"","position":"0","active":"1","esdactive":"0","embediframe":"","hideprospect":"0","action":null,"pluginID":"134","source":"1425514","mobile_inactive":"0","attributes":{"core":{"id":"126","paymentmeanID":"185","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"klarna_paynow_pay_now_with_klarna","adyen_stored_method_id":""}},"attribute":{"id":"126","paymentmeanID":"185","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"klarna_paynow_pay_now_with_klarna","adyen_stored_method_id":""},"enriched":true,"image":"https:\/\/checkoutshopper-live.adyen.com\/checkoutshopper\/images\/logos\/klarna_paynow.svg","isStoredPayment":false,"isAdyenPaymentMethod":true,"adyenType":"klarna_paynow","metadata":{"name":"Sofort bezahlen mit Klarna.","type":"klarna_paynow"}},{"id":"187","name":"paysafecard_paysafecard","description":"Paysafecard","template":"","class":"","table":"","hide":"0","additionaldescription":"","debit_percent":"0","surcharge":"0","surchargestring":"","position":"0","active":"1","esdactive":"0","embediframe":"","hideprospect":"0","action":null,"pluginID":"134","source":"1425514","mobile_inactive":"0","attributes":{"core":{"id":"128","paymentmeanID":"187","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"paysafecard_paysafecard","adyen_stored_method_id":""}},"attribute":{"id":"128","paymentmeanID":"187","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"paysafecard_paysafecard","adyen_stored_method_id":""},"enriched":true,"image":"https:\/\/checkoutshopper-live.adyen.com\/checkoutshopper\/images\/logos\/paysafecard.svg","isStoredPayment":false,"isAdyenPaymentMethod":true,"adyenType":"paysafecard","metadata":{"name":"Paysafecard","type":"paysafecard"}},{"id":"175","name":"scheme_credit_card","description":"Credit Card","template":"","class":"","table":"","hide":"0","additionaldescription":"","debit_percent":"0","surcharge":"0","surchargestring":"","position":"0","active":"1","esdactive":"0","embediframe":"","hideprospect":"0","action":null,"pluginID":"134","source":"1425514","mobile_inactive":"0","attributes":{"core":{"id":"116","paymentmeanID":"175","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"scheme_credit_card","adyen_stored_method_id":""}},"attribute":{"id":"116","paymentmeanID":"175","swag_paypal_unified_display_in_plus_iframe":"0","swag_paypal_unified_plus_iframe_payment_logo":null,"adyen_type":"scheme_credit_card","adyen_stored_method_id":""},"enriched":true,"image":"https:\/\/checkoutshopper-live.adyen.com\/checkoutshopper\/images\/logos\/card.svg","isStoredPayment":false,"isAdyenPaymentMethod":true,"adyenType":"scheme","metadata":{"brands":["visa","mc","amex","mealVoucher_FR"],"details":[{"key":"encryptedCardNumber","type":"cardToken"},{"key":"encryptedSecurityCode","type":"cardToken"},{"key":"encryptedExpiryMonth","type":"cardToken"},{"key":"encryptedExpiryYear","type":"cardToken"},{"key":"holderName","optional":true,"type":"text"}],"name":"Kreditkarte","type":"scheme"}},{"id":"64","name":"SwagPaymentPayPalUnified","description":"PayPal","template":"","class":"","table":"","hide":"0","additionaldescription":"&lt;!-- PayPal Logo --&gt;&lt;a href=\"https:\/\/www.paypal.com\/de\/cgi-bin\/webscr?cmd=xpt\/cps\/popup\/OLCWhatIsPayPal-outside\" target=\"_blank\" rel=\"noopener\"&gt;&lt;img src=\"{link file=

bortefi commented 2 years ago

@webtech-tom

Thanks for the dump, the issue is the PayPal payment method that is coming from SwagPayPal. We are aware of the incompatibility with the Swag Pay Pall plugin, it will however be addressed in the next release of the Adyen Plugin.

One option is to disable the SwagPayPall if it is not required, alternatively a partial fix would be to modify:
https://github.com/Adyen/adyen-shopware5/blob/3.2.0/Shopware/Serializer/SwPaymentMeanSerializer.php#L19

<?php
// replace
'additionaldescription' => Sanitize::escape($paymentMean->getValue('additionaldescription')),
// with the following (a partial workaround for swagPayPal plugin,
'additionaldescription' => htmlspecialchars($paymentMean->getValue('additionaldescription'), ENT_QUOTES),

This will make certain the payment methods are available to be shown, but it is not validated how the SwagPayPal plugin will behave.

jensorben commented 2 years ago

We fixed the Paypal Problem by removing the Paypal-Logo only, which is added by a link in the additional description (=> Screenshot Screenshot 2022-01-14 132359 )

webtech-tom commented 2 years ago

@jensorben You're totally right. Thanks a lot for your help!

jensorben commented 2 years ago

@webtech-tom Thanks! But the next challenge is ahead: We can place and pay orders, as a logged on and registered shopper! If we do this as a guest shopper without an account, we're getting this error on checkout page: Screenshot 2022-01-14 150110

SW-Version: 5.7.7 PHP: 7.4

webtech-tom commented 2 years ago

@jensorben Fortunately we do not have this problem. But we have the problem with guest shoppers who declined the cookies. Then this error occurs at the checkout "The payment has been cancelled. Please activate the cookies": image

dcmgcm commented 2 years ago

@webtech-tom did you check the cookie consent? It seems like there is no "Adyen Payments" cookie like in the older versions. But referring to this file https://github.com/Adyen/adyen-shopware5/blob/develop/Subscriber/CookieSubscriber.php there should be one.

NilsVankan commented 2 years ago

@jensorben as a guest you should be able to place orders without an account on the 3.2 version. Could you verify with accepting the cookies and then trying again? This should resolve the error message.

King regards

jensorben commented 2 years ago

@NilsVankan As @dcmgcm wrote, we hadn't any cookie set by the 3.2 Plugin! We tried a local installation with the plugin 3.2 and ran shopware with a deactivated cookie-consent! In both cases no cookie was set by plugin!

bortefi commented 2 years ago

@jensorben , @dcmgcm

Shopware is strict in it's cookie policy: https://docs.shopware.com/en/shopware-5-en/settings/privacy#notice-mode

If the Shopper does not explicitly accepts cookies for their browser, the plugin is not allowed the create them. Therefore at the minimum the technical cookies need to be accepted by the end-user in order to be able to place an order.

@Suzell, @NilsVankan what could be improved upon is to mention the plugin's cookie functionality in the list: image

webtech-tom commented 2 years ago

@bortefi So the problem in our system (when the user declined the cookies) is, that this error message just occurs when one of the payment methods from the adyen plugin has been chosen. If for example the PayPal Payment has been chosen, then there is no error message.

So should we integrate a Link in the error message to get to the cookie selection?

Thanks a lot!

NilsVankan commented 2 years ago

Hey Tom,

I tested it and if I refuse the cookies with Paypal i still get the next error message: MicrosoftTeams-image (1)

We could possible improve this error message by adding an integration to again accept the cookies.

Kind regards