When an order (a booking transaction) is deleted, its payment records are left behind, still pointing at a transaction that no longer exists.

Every module that hangs entities off the order cleans them up on delete through hook_yoyaku_transaction_predelete(): the engine removes the order's booking lines, and the workflow bridge removes its process instance. yoyaku_payment does not, so its BookingPayment entities (which reference the order) are orphaned.

Proposed fix

Add a yoyaku_transaction_predelete hook in yoyaku_payment that deletes the payments referencing the order, mirroring the engine's booking-line cleanup. The durable record survives in the payment audit trail, and a stored-card token is already forgotten at the gateway on cancellation (the StoredCardCleanup subscriber), so this only removes the now-orphaned operational rows.

Issue fork yoyaku-3609081

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review

  • mably committed d73c2cdd on 1.x
    fix: #3609081 Purge an order's payments when the order is deleted
    
    By:...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.