Skip to content

feat: unenroll and expire entitlements on returns#527

Merged
bseverino merged 5 commits intomainfrom
bseverino/RV2U-321-revoke-entitlement
Mar 31, 2026
Merged

feat: unenroll and expire entitlements on returns#527
bseverino merged 5 commits intomainfrom
bseverino/RV2U-321-revoke-entitlement

Conversation

@bseverino
Copy link
Copy Markdown
Member

@bseverino bseverino commented Mar 16, 2026

Internal ticket: https://redventures.atlassian.net/browse/RV2U-460

Merge checklist:
Check off if complete or not applicable:

  • Documentation updated (not only docstrings)
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Manual testing instructions provided
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

Post-merge:

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 16, 2026

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  commerce_coordinator/apps/commercetools
  signals.py
  tasks.py
  utils.py
  views.py
  commerce_coordinator/apps/commercetools/tests
  test_signals.py
  test_tasks.py
  commerce_coordinator/apps/order_fulfillment
  clients.py
  exceptions.py
  serializers.py
Project Total  

This report was generated by python-coverage-comment-action

@bseverino bseverino force-pushed the bseverino/RV2U-321-revoke-entitlement branch from 8645437 to 7ee6fec Compare March 20, 2026 16:59
@bseverino bseverino marked this pull request as ready for review March 20, 2026 16:59
@bseverino bseverino requested a review from a team as a code owner March 20, 2026 16:59
Copilot AI review requested due to automatic review settings March 20, 2026 16:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “order returned” flow that triggers LMS unenrollment and entitlement expiration by enqueueing a dedicated revoke task when Commercetools sends a return event.

Changes:

  • Wire the Commercetools “order returned” signal to a new revoke_line_items receiver via CC_SIGNALS.
  • Implement revoke_line_items_task to resolve returned line items and call Order Fulfillment’s revoke-line endpoint (including entitlement UUID when present).
  • Expand tests and update related docstrings/serializers to support the new revoke payload.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
commerce_coordinator/settings/base.py Registers revoke_line_items receiver for the returned-order signal.
commerce_coordinator/apps/order_fulfillment/serializers.py Adds optional entitlement_uuid field to the revoke-line request serializer.
commerce_coordinator/apps/commercetools/views.py Updates returned-order view docstrings to reflect revoke behavior.
commerce_coordinator/apps/commercetools/tasks.py Adds revoke_line_items_task implementation to unenroll/expire on returns.
commerce_coordinator/apps/commercetools/signals.py Adds revoke_line_items signal receiver that enqueues the new task.
commerce_coordinator/apps/commercetools/tests/test_tasks.py Adds unit tests for revoke_line_items_task.
commerce_coordinator/apps/commercetools/tests/test_signals.py Adds unit tests for the new revoke_line_items signal receiver.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread commerce_coordinator/apps/commercetools/tasks.py
Comment thread commerce_coordinator/apps/commercetools/tasks.py
Comment thread commerce_coordinator/apps/commercetools/tasks.py Outdated
Comment thread commerce_coordinator/apps/commercetools/tasks.py Outdated
@bseverino bseverino force-pushed the bseverino/RV2U-321-revoke-entitlement branch from 7ee6fec to 6e49ac7 Compare March 26, 2026 17:48
Copilot AI review requested due to automatic review settings March 26, 2026 18:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread commerce_coordinator/apps/commercetools/tasks.py Outdated
Comment thread commerce_coordinator/apps/commercetools/tasks.py Outdated
Comment thread commerce_coordinator/apps/commercetools/tasks.py Outdated
@bseverino bseverino force-pushed the bseverino/RV2U-321-revoke-entitlement branch from cd1fae5 to 73f6a42 Compare March 26, 2026 18:56
Copy link
Copy Markdown

@nazarioricardo nazarioricardo left a comment

Choose a reason for hiding this comment

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

lgtm

@bseverino bseverino merged commit a05e042 into main Mar 31, 2026
8 checks passed
@bseverino bseverino deleted the bseverino/RV2U-321-revoke-entitlement branch March 31, 2026 17:41
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.

4 participants