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

[DX] Dispatch ui event to allow customize every choice in payment method selection #15384

Merged
merged 2 commits into from Apr 23, 2024

Conversation

Jibbarth
Copy link
Contributor

Q A
Branch? 1.13
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets fixes #X, partially #Y, mentioned in #Z
License MIT

To help PaymentPlugin providers, let's dispatch an ui event inside choice of each payment method. This will allow paymentPlugins to add additionnal field easily without the pain while installing paymentPlugins to copy/paste template that override SyliusShopBundle/Checkout/SelectPayment/_payment.html.twig (for example in Mollie) or SyliusShopBundle/Checkout/SelectPayment/_choice.html.twig (like in Payplug)

I targetted 1.13 as it could be considered as a new feature, and paymentPlugins will can start to use it configuring a sylius_ui event block, and still provide template to copy/paste for previous version.

WDYT ?

I'm also wondering if we should merge the GatewayFactory name inside the event name to avoid lot of check on method when creating a new block.

@Jibbarth Jibbarth requested a review from a team as a code owner September 29, 2023 11:38
@probot-autolabeler probot-autolabeler bot added the Shop ShopBundle related issues and PRs. label Sep 29, 2023
@github-actions
Copy link

github-actions bot commented Sep 29, 2023

Bunnyshell Preview Environment deleted

Available commands:

  • /bns:deploy to redeploy the environment

oallain
oallain previously approved these changes Sep 29, 2023
@@ -11,5 +11,6 @@
<p>{{ method.description }}</p>
</div>
{% endif %}
{{ sylius_template_event('sylius.shop.checkout.select_payment.choice_item_content', {'method': method}) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add the label and description to a specific template and add it as a block of this new event ?

Copy link
Member

@diimpp diimpp Sep 29, 2023

Choose a reason for hiding this comment

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

Agree, the way event is added now, it won't work for mollie, existing snippet with method.description needs to be extracted into external template and imported back via ui event.

However, this raises a question: should it be done only for payment method choice or for shipping methods and rest of the checkout as well? cc @jakubtobiasz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the label, it would need to pass the form into. I don't think it could be relevant for others event, but maybe i'm wrong.

However, I can extract descritption in that block.

For shipping method, it could be useful too, regarding PickupPoint providers plugin for example, but maybe it should be done in another PR ?

@jakubtobiasz jakubtobiasz force-pushed the feature/ui-event-for-select-payment branch from 8099fe1 to 5639e58 Compare December 21, 2023 10:37
@jakubtobiasz jakubtobiasz self-assigned this Dec 21, 2023
@Jibbarth
Copy link
Contributor Author

Jibbarth commented Feb 5, 2024

@jakubtobiasz Is there anything else i can do here ?

@GSadee GSadee closed this Apr 22, 2024
@GSadee GSadee reopened this Apr 22, 2024
@GSadee GSadee requested a review from a team as a code owner April 22, 2024 13:52
@GSadee GSadee merged commit cdd979b into Sylius:1.13 Apr 23, 2024
53 of 54 checks passed
@GSadee
Copy link
Member

GSadee commented Apr 23, 2024

Thanks, Jibé! 🎉

GSadee added a commit that referenced this pull request Apr 23, 2024
… (Jibbarth, GSadee)

This PR was merged into the 1.13 branch.

Discussion
----------


| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | 1.13 <!-- see the comment below -->                  |
| Bug fix?        | no                                                       |
| New feature?    | yes                                                       |
| BC breaks?      | no                                                       |
| Deprecations?   | no <!-- don't forget to update the UPGRADE-*.md file --> |
| Related tickets | N/A                      |
| License         | MIT                                                          |


Following #15384, this add a `sylius.shop.checkout.select_shipping.choice_item_content` and a `sylius.shop.checkout.select_shipping.choice_item_extra` ui events.

Description and fee are now extracted and injected through this new events



Commits
-------

d9e799e [DX][Checkout][ShippingMethod] Dispatch new ui events
0ad2c0f Merge branch '1.13' into feature/ui-event-for-select-shipping
@Jibbarth Jibbarth deleted the feature/ui-event-for-select-payment branch April 23, 2024 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Shop ShopBundle related issues and PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants