Skip to content

CSP migration#113

Merged
candemiralp merged 13 commits into
adyen-examples:developfrom
JeroenBoersma:csp-compatibility-generated
Jul 9, 2025
Merged

CSP migration#113
candemiralp merged 13 commits into
adyen-examples:developfrom
JeroenBoersma:csp-compatibility-generated

Conversation

@JeroenBoersma

Copy link
Copy Markdown
Contributor

Summary

I checked all code against the with the new standard, which meant moving all non-global JS into a global JS file.

Added AlpineJS components to initialize the payment methods on request (if magewire->methodCode is correct)

Read our documentation for theme and checkout changes

Updated requirements in composer.json

  • requirement hyva-themes/magento2-theme-module (^1.3.11)
  • requirement hyva-themes/magento2-hyva-checkout (^1.3)

Tested scenarios

Tested the code with a test account, didn't run all payment methods yet.

Still needs manual testing

Fixed issue: #109

notes

I've seen the other PR in here which didn't reworked all the files, this time we did.

This will run several tools to optimize your code, find more about CSP
Read our documentation for [theme](https://docs.hyva.io/hyva-themes/writing-code/csp/index.html) and [checkout](https://docs.hyva.io/checkout/hyva-checkout/devdocs/csp/index.html) changes

- @todo! means **work todo**, please review
- @done! means **no work todo**, just informing about the change

- requirement `hyva-themes/magento2-theme-module` (`^1.3.11`) @done!
- requirement `hyva-themes/magento2-hyva-checkout` (`^1.3`) @done!
@Aquive

Aquive commented May 16, 2025

Copy link
Copy Markdown

@JeroenBoersma thanks for this! Would you know if this also solves #111?

@Adyen when will this be checked/accepted?

@candemiralp

Copy link
Copy Markdown
Contributor

Hello @JeroenBoersma,

Thank you for this massive contribution and for your effort to make the module compatible with the latest version of the Hyvä Checkout module.

We will review and merge the code if everything goes well.

Best Regards,
Can

@Aquive

Aquive commented May 19, 2025

Copy link
Copy Markdown

@candemiralp thanks for the update. Any ETA on this?

@candemiralp candemiralp linked an issue May 19, 2025 that may be closed by this pull request
@candemiralp

Copy link
Copy Markdown
Contributor

Hello @Aquive,

Thank you, there is no ETA at the moment (yet) but we are discussing this internally. I will update everyone soon.

Best Regards,
Can

function adyenHyvaPaymentModal() {
return Object.assign(
hyva.modal(),
,{

@aadmathijssen aadmathijssen May 21, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line triggers a syntax error.

In Firefox, the following console error is logged for this line:

Uncaught SyntaxError: expected expression, got ','

In Chome, the following console error is logged for this line:

Uncaught SyntaxError: Unexpected token ','

@aadmathijssen aadmathijssen May 21, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Removing the comma on this line fixes this syntax error, but reveals another one: on the next line. On that line, a comma should be added.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pushed and fixed, thanks @aadmathijssen for blending in

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks Jeroen, I can confirm that this is resolved. However, another syntax error is present on the next line. I left a separate comment for that.

return Object.assign(
hyva.modal(),
{
isLoading: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line triggers a syntax error.

In Firefox, the following console error is logged for this line:

Uncaught SyntaxError: missing } after property list

@JeroenBoersma

Copy link
Copy Markdown
Contributor Author

So, we got some feedback from clients saying that still some stuff was off, which made me revisit the problem...

Last time I had a comma to much, now somewhere else I was lacking a comma. Sorry for that.

Next step was looking at the rest of the feedback, as it turns out, Adyen overwrites \Adyen\Hyva\Magewire\Payment\MethodList and because of the Hyva Checkout update this was no longer compatible. This is not the ideal way to solve these things, so, instead I now extend the original, so the original code can be updated and the extra functionality which is Adyen specific, still works.

Because all the things are loaded via AlpineJS we can drop the eventListener approach, as the payment method is only loaded when it is active, this reduces a lot of the complexity it had.

I asked our partner to test and the first feedback that it does work as expected.

I did the same with a testing account and that also seems to work just fine!

@Aquive

Aquive commented May 28, 2025

Copy link
Copy Markdown

Great work @JeroenBoersma thanks for all the effort! I would have also loved it to test the extension. But since we need to go online asap I had to downgrade to Hyva Checkout v1.2.0, otherwise I would have tested it. Thanks again!

@JeroenBoersma

Copy link
Copy Markdown
Contributor Author

image

@candemiralp candemiralp requested a review from aadmathijssen July 9, 2025 11:47
@candemiralp candemiralp merged commit 026abe4 into adyen-examples:develop Jul 9, 2025
0 of 3 checks passed
@candemiralp candemiralp added the Feature Indicates a new feature addition label Jul 9, 2025
@candemiralp

Copy link
Copy Markdown
Contributor

Hello @JeroenBoersma,

Thank you for your great contribution to make our compatibility module CSP compliant. This PR has been merged and a new version will be released soon.

Best Regards,
Can

This was referenced Jul 9, 2025
@khushboo-singhvi khushboo-singhvi mentioned this pull request Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Indicates a new feature addition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ECP-9692] Compatibility with Hyvä Checkout 1.3.0

5 participants