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

Generators #3235

Draft
wants to merge 7 commits into
base: 4.x
Choose a base branch
from
Draft

Generators #3235

wants to merge 7 commits into from

Conversation

AugustMiller
Copy link
Contributor

@AugustMiller AugustMiller commented Jul 28, 2023

I was exploring some stuff in the Commerce extension docs and figured it was worth implementing Generators for some of the common components. My primary motivation is to have some external examples to point at, and to move some of the fussy out-of-context method signature stuff into code that can be maintained with the package, rather than as external documentation.

This introduces three new options, when the Generator is installed:

  • Adjusters (craft make adjuster): Stubs and registers a new Order Adjuster class in the specified module or plugin;
  • Gateways (craft make gateway): Stubs and registers a new Gateway class in the specified module or plugin (as well as creating the appropriate payment form and request/response models, and the corresponding back- and front-end templates);
  • Shipping Method (craft make shipping-method): Stubs a new shipping method in the specified module or plugin (developer is responsible for registering it, as the logic for this is significantly different based on whether you just need a single hard-coded method or many methods—say, defined by and loaded from a third-party service);

Submitting as a Draft, because this definitely needs a second set of eyes… but I'm also not confident this covers even a fraction of the extension surface area. Purchasables are probably the biggest omission—and I don't even know where to begin with Tax Engines! 😂

Todo:

  • Adjusters
  • Gateways
  • Shipping Methods
  • Purchasables (unsure of workload here—seems like it would be pretty similar to make element-type…)

@AugustMiller
Copy link
Contributor Author

Ah, interesting—PHPStan fails because craftcms/generator probably needs to be in require-dev?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants