Module: Spree::RefundDecorator

Defined in:
app/models/spree/refund_decorator.rb

Overview

The only decorator in this gem, and it must not grow.

Spree 5.6 publishes no refund.created event, and the returns flow (reimbursement.reimbursed, handled by Kashflow::ReimbursementSubscriber) does not cover an admin issuing an ad-hoc refund directly against a payment — the most common manual path. Left unmirrored, that path would reintroduce the ledger drift KashFlow credit notes exist to prevent, so this decorator enqueues Kashflow::SyncRefundJob on every refund. It does nothing else: no client, no payload building, no integration lookup — the job already no-ops when no active integration exists.

If Spree ever adds a refund.created event, delete this decorator in favour of a Spree::Kashflow::RefundCreatedSubscriber.

Class Method Summary collapse

Class Method Details

.prepended(base) ⇒ void

This method returns an undefined value.

Parameters:

  • base (Class)

    Spree::Refund, the class this module is prepended to



25
26
27
# File 'app/models/spree/refund_decorator.rb', line 25

def self.prepended(base)
  base.after_create_commit -> { Spree::Kashflow::SyncRefundJob.perform_later(id) }
end