Skip to content

feat: added events to subscription #594

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

Merged
merged 1 commit into from
Jul 11, 2025

Conversation

demeyerthom
Copy link
Member

This pull request introduces several updates across multiple files to enhance the functionality of the Commercetools Terraform provider. The most significant changes include adding support for event subscriptions, updating dependencies in the go.mod file, and improving the handling of subscription update actions. Below is a breakdown of the most important changes grouped by theme:

Support for Event Subscriptions:

  • Added a new event block to the subscription schema, allowing users to subscribe to specific events. This includes attributes for resource_type_id and types, with detailed descriptions provided in docs/resources/subscription.md and internal/resources/subscription/resource.go. [1] [2]
  • Implemented the Event struct in internal/resources/subscription/model.go, including methods to convert between native and platform event subscription formats.
  • Updated subscription creation and update logic to handle event subscriptions, including the addition of eventsAction in the OrderSubscriptionTypesActions function. [1] [2]

Dependency Updates:

  • Upgraded several dependencies in the go.mod file, including golang.org/x/text, golang.org/x/crypto, and github.com/labd/commercetools-go-sdk, to ensure compatibility and leverage the latest features. [1] [2]

Subscription Update Logic Improvements:

  • Refactored the OrderSubscriptionTypesActions function to include event subscriptions and ensure proper ordering of actions based on non-empty attributes.
  • Updated tests in internal/resources/subscription/model_test.go to cover scenarios involving event subscriptions and validate the updated logic. [1] [2]

Documentation Enhancements:

  • Added examples and descriptions for event subscriptions in docs/resources/subscription.md and examples/resources/commercetools_subscription/resource.tf, providing clear guidance for users. [1] [2]

Minor Code Improvements:

  • Updated the SortOrder field in resourceCartDiscountCreate to use a helper function for string references, improving code consistency.

@demeyerthom demeyerthom linked an issue Jun 27, 2025 that may be closed by this pull request
@demeyerthom demeyerthom marked this pull request as ready for review July 11, 2025 08:46
@demeyerthom demeyerthom requested a review from a team as a code owner July 11, 2025 08:46
@demeyerthom demeyerthom force-pushed the 593-support-for-event-type-subscriptions branch from c5af142 to e47bc80 Compare July 11, 2025 09:15
@demeyerthom demeyerthom merged commit 26620cf into main Jul 11, 2025
2 checks passed
@demeyerthom demeyerthom deleted the 593-support-for-event-type-subscriptions branch July 11, 2025 11:42
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.

Support for event type subscriptions
1 participant