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

[4.x]: Gateway Events #3224

Open
AugustMiller opened this issue Jul 18, 2023 · 1 comment
Open

[4.x]: Gateway Events #3224

AugustMiller opened this issue Jul 18, 2023 · 1 comment
Assignees
Labels
commerce4 Issues related to Commerce v4 💡 enhancement Ideas and suggestions
Milestone

Comments

@AugustMiller
Copy link
Contributor

AugustMiller commented Jul 18, 2023

What happened?

Description

Events are not currently emitted by craft\commerce\base\Gateway or craft\commerce\services\Gateways when saving a Gateway’s configuration.

Craft typically emits events from the service class when saving Project Config-bound changes (beforeSave when modifying values, then afterSave in a PC event handler). The model events appear to be less consistently triggered…

Steps to reproduce

  1. Add a listener in a custom module:
    use craft\events\ModelEvent;
    use craft\commerce\base\Gateway;
    use yii\base\Event;
    
    Event::on(
       Gateway::class,
       Gateway::EVENT_BEFORE_SAVE,
        function(craft\events\ModelEvent $event) {
            Craft::dd('Got it!');
        }
    );
  2. Save a new or existing gateway

Expected behavior

  • Using the example code, the page is halted.
  • I should also be able to listen to events from the service class, i.e. craft\commerce\services\Gateways::EVENT_BEFORE_SAVE_GATEWAY.

Actual behavior

No event is triggered.


Originally reported on Discord!

@AugustMiller AugustMiller added bug commerce4 Issues related to Commerce v4 labels Jul 18, 2023
@lukeholder lukeholder added this to the 5.0 milestone Jul 25, 2023
@lukeholder lukeholder added 💡 enhancement Ideas and suggestions and removed bug labels Jul 25, 2023
@lukeholder
Copy link
Member

lukeholder commented Jul 25, 2023

Thanks for reporting. This is the same for some other project config based settings. Added this to the list for Commerce 5.

Others will include:

  • Order Statuses
  • Line Item Statuses
  • Gateways
  • Emails
  • PDFs
  • Product Types

@lukeholder lukeholder self-assigned this Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commerce4 Issues related to Commerce v4 💡 enhancement Ideas and suggestions
Projects
None yet
Development

No branches or pull requests

2 participants