diff --git a/core/app/models/spree/reimbursement.rb b/core/app/models/spree/reimbursement.rb index 3e91130bbc2..1a4472616bd 100644 --- a/core/app/models/spree/reimbursement.rb +++ b/core/app/models/spree/reimbursement.rb @@ -104,10 +104,20 @@ def perform!(created_by: nil) if unpaid_amount_within_tolerance? reimbursed! Spree::Event.fire 'reimbursement_reimbursed', reimbursement: self + if reimbursement_success_hooks.any? + Spree::Deprecation.warn \ + "reimbursement_success_hooks are deprecated. Please remove them " \ + "and subscribe to `reimbursement_reimbursed` event instead", caller(1) + end reimbursement_success_hooks.each { |hook| hook.call self } else errored! Spree::Event.fire 'reimbursement_errored', reimbursement: self + if reimbursement_failure_hooks.any? + Spree::Deprecation.warn \ + "reimbursement_failure_hooks are deprecated. Please remove them " \ + "and subscribe to `reimbursement_errored` event instead", caller(1) + end reimbursement_failure_hooks.each { |hook| hook.call self } end