Skip to content

DEV-5582 Call TaxCloud Returned on canceled unpaid orders#19

Merged
azane-code merged 4 commits intomasterfrom
DEV-5582/magento-taxcloud-cancel-return
Mar 6, 2026
Merged

DEV-5582 Call TaxCloud Returned on canceled unpaid orders#19
azane-code merged 4 commits intomasterfrom
DEV-5582/magento-taxcloud-cancel-return

Conversation

@azane-code
Copy link
Contributor

@azane-code azane-code commented Mar 4, 2026

DEV-5582: Reverse TaxCloud sale when order is canceled (unpaid, no invoices)

Summary

When an order is canceled and has no invoices, we now call the TaxCloud Returned API so the sale is reversed in TaxCloud. Whether we call Returned is based on TaxCloud’s OrderDetails API (non-empty CapturedDate). This uses TaxCloud v1 only (no Void).

Changes

  • Observer/Sales/Cancel.php (new): Listens to order_cancel_after and sales_order_save_after; runs only when the order is canceled, has no invoices, and TaxCloud reports it as captured (OrderDetails returns a non-empty CapturedDate). Calls Api::getOrderDetails($order) then Api::returnOrderCancellation($order);
  • Model/Api.php: Adds getOrderDetails($order) (SOAP OrderDetails; returns result array or null). Adds returnOrderCancellation($order) (builds cart from order, calls Returned, no creditmemo).
  • Events: Both events wired to the Cancel observer in etc/events.xml.

README updated with cancellation behavior (OrderDetails/CapturedDate) and events table.

@azane-code azane-code requested a review from GusOhnesorge March 5, 2026 19:08
…_captured flag for cancel Returned decision
Copy link
Contributor

@GusOhnesorge GusOhnesorge left a comment

Choose a reason for hiding this comment

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

Non blocking thought. Nice work!

@azane-code azane-code merged commit 21f7d0a into master Mar 6, 2026
4 of 7 checks passed
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.

2 participants