buckaroo-it / Magento2

Repository containing the Magento2 plugin by Buckaroo
MIT License
28 stars 35 forks source link

Ideal payment method selection triggers "Please select a issuer from the list" error #350

Closed NickdeK closed 2 years ago

NickdeK commented 3 years ago

This happens in vendor/buckaroo/magento2/view/frontend/web/js/view/payment/method-renderer/ideal.js:153 that triggers a set-payment-information request. This eventually leads to a response from vendor/buckaroo/magento2/Model/Method/Ideal.php:155 with the error.

buckaroo_ideal_error_1 buckaroo_ideal_error_2

I think no validation should be done when a user clicks the iDeal payment method without selecting a bank. I saw the $skipValidation check in vendor/buckaroo/magento2/Model/Method/Ideal.php:139 and tried to manipulate the data in vendor/buckaroo/magento2/view/frontend/web/js/view/payment/method-renderer/ideal.js:153 to add the buckaroo_skip_validation in the additional_data (as done here vendor/buckaroo/magento2/view/frontend/web/js/view/payment/save-payment.js:80) in the hopes to prevent this issue without succes. In vendor/magento/module-sales-rule/view/frontend/web/js/action/select-payment-method-mixin.js:26 the data is consumed and only the paymentMethod.method is extracted to eventually by added to the payload, the buckaroo_skip_validation therefor never reaches the validation method in the PHP file.

I'm confused why the validation is done on payment selection. The user is clearly in the process of filing in the required forms, generating the exception is a bit eager I think.

Buckaroo-Rens commented 3 years ago

Thanks @NickdeK, we are looking into this :)

NickdeK commented 3 years ago

Hi @Buckaroo-Rens, sorry to bother you, but do you have any update on this? If you have a quick fix that we could apply temporally that would be already by helpful :)

florinel-chis commented 3 years ago

Hi @NickdeK I went through the reported issue and compared it with the standard Magento checkout that is supported

buckaroo-ideal-skip-validation

The request sent to set-payment-information contains the skip-validation

{
  "method": "buckaroo_magento2_ideal",
  "additional_data": {
    "buckaroo_skip_validation": "true"
  }
}

and it's been like that for quite some time, due to save-payment.js - see the selector:

payload.paymentMethod = {
                        method: $('.payment-methods input[type="radio"][name="payment[method]"]:checked').data('method') || $('.payment-methods input[type="radio"][name="payment[method]"]:checked').val(),
                        additional_data: {
                            buckaroo_skip_validation: 'true'
                        }
                    };

The Rubic_CleanCheckout extension seems to impact the way this works and would need more information about how the module is actually is implemented on the environment you are using. If you can please email to support@buckaroo.nl some details about where we can have a look at the dev/test environment or share additional details, we can continue the conversation on the support channel.

Buckaroo-Rens commented 2 years ago

Fixed and released in v1.39.0 (blind fix).

glevhen commented 2 years ago

@Buckaroo-Rens the issue still present in v1.39.0 (Magento 2.4.3) default checkout

Buckaroo-Rens commented 2 years ago

@glevhen Sorry but this is not reproducible from our side. Not in standard checkout as well in OneStepCheckout. Please send a email to support@buckaroo.nl with your research and access (ftp/ssh) to your staging environment.

raoulguillermo commented 1 year ago

I have the same issue when using the magento graphql: when calling this mutation { setPaymentMethodOnCart( input: { cart_id: "" payment_method: { code: "buckaroo_magento2_ideal" } }

) { cart { selected_payment_method { code title } } } }

i get this as a result { "errors": [ { "message": "Please select a issuer from the list", "extensions": { "category": "graphql-input" }, "locations": [ { "line": 14, "column": 3 } ], "path": [ "setPaymentMethodOnCart" ] } ], "data": { "setPaymentMethodOnCart": null } }

harli91 commented 1 year ago

@raoulguillermo the graphql query should look like:


    input: {
      cart_id: $cartId
      payment_method: {
        code: $methodCode
        buckaroo_additional: { buckaroo_magento2_ideal: { issuer: "ABNANL2A" } }
      }
    }
  ) {
    cart {
      items {
        product {
          name
          sku
        }
      }
    }
  }```
raoulguillermo commented 1 year ago

@raoulguillermo the graphql query should look like:

    input: {
      cart_id: $cartId
      payment_method: {
        code: $methodCode
        buckaroo_additional: { buckaroo_magento2_ideal: { issuer: "ABNANL2A" } }
      }
    }
  ) {
    cart {
      items {
        product {
          name
          sku
        }
      }
    }
  }```

works!