PAYONE-GmbH / shopware-5

PAYONE Payment Plugin for shopware 5
MIT License
10 stars 24 forks source link

Errormessage not in Storefront #85

Closed Jupdi closed 7 years ago

Jupdi commented 7 years ago

Many of the Errormessages aren't displayed in the Storefront. Instead of just printing the customermessage from the response, the message is loaded from the snippets via the moptGetErrorMessageFromErrorCodeViaSnippet function, which mainly returns an empty string.

Here in the _mopt_payone_handleDirectFeedback function, the ratepayError gets the status directly from the response, but almost all other load it from the snippet.

  protected function mopt_payone__handleDirectFeedback($response)
    {
        $session = Shopware()->Session();
        $paymentId = $this->getPaymentShortName();
        if ($response->getStatus() == 'ERROR' && $paymentId === 'mopt_payone__fin_ratepay_invoice') {
            $session->ratepayError = $response->getCustomermessage();
            $this->forward('ratepayError');
        } elseif ($response->getStatus() == 'ERROR') {
            $session->payoneErrorMessage = $this->moptPayoneMain->getPaymentHelper()
                    ->moptGetErrorMessageFromErrorCodeViaSnippet(false, $response->getErrorcode());
            $this->forward('error');
        } else {

I would recommend to either always load the customermessage or use the customermessage as a fallback.

T-Kuchel commented 7 years ago

Hi @Jupdi

the customermessage often is very technical, and the buyer would not have any idea how to handle with it. i.e. errocode=911 Reference number already exists

So we build a snippet method for every errorcode than can appear. The snippet is created when a unknown errcode occurs.After that it will be filled the general error-message, and you can customize this message for your needs.

In case of ratepay it was mandatory from ratepay itself, to deliver the message from the ratepay system directly to the buyer. That is the reason for this handling.

Jupdi commented 7 years ago

Hi @T-Kuchel the main Problem why i opened the issue, because we alway get the same error message in the storefront, no matter which error is thrown.

In the backend i can see the response with a perfect message(customermessage) that whould help our customers. I would like to see this printed to the storefront.

bildschirmfoto 2017-05-10 um 09 44 29

T-Kuchel commented 7 years ago

you should have a snippet with the name errorMessage872 in the snippets (Textbausteine) menu. There you can customize the message. If you have not customzied it, the generalErrorMessage ('Es ist ein Fehler aufgetreten') for de_DE will be shown in the frontend.

Jupdi commented 7 years ago

Thanks for you fast answers! Okay i found the snippets, but why do i need to fill the Snippets myself? It would be more convenient to just use the customermessage that is printed in the API Log. Never had any that wouldn't be readable for our customers. Is there a list for a mapping from errorcode to the error that occurred?

T-Kuchel commented 7 years ago

In the past many of our merchants complain about the messages from our system (to technical, not easy to understand if you not a e-commerce pro, ...). So we decided to show always a general errormessage, but if it is necessary, you can modify the message. If the snippet with the errorcode is not present you can create it.

You will find the errorcodes in the server-api-documentation chapter 5.7. Here you can download the PDF: PAYONE Server-API

Jupdi commented 7 years ago

Great thanks!

Jupdi commented 7 years ago

Hi @T-Kuchel sorry i need to reopen this, but i recognized, that not even the generalErrorMessage ('Es ist ein Fehler aufgetreten'), will be Shown in the Storefront. So if i customize the message there will be no changes.

T-Kuchel commented 7 years ago

Wich errorcode is not shown? I tried it in our demoshop (V5.2.22) and the message appears (javascript alert). errorcode 1077

grafik

Jupdi commented 7 years ago

There is no error code, i dont get any javascript alerts, and the h2-Tag that should hold the errormessage, keeps empty.

Storefront: bildschirmfoto 2017-05-10 um 13 34 24

If i'm right the Page is rendered from the error.tpl , but the errormessage is always empty.

T-Kuchel commented 7 years ago

Ok. You are already at the "endpoint" of the transaction. Anyway. This is also working fine at our Systems. Maybe you are running an older Version. i.e. 3.4.8 of the plugin? The actual version 3.5.0 is working fine.

grafik