Skip to content

Commit

Permalink
Merge pull request #3541 from nebulab/spaghetticode/deprecate-reimbur…
Browse files Browse the repository at this point in the history
…sement-hooks

Depreacate reimbursement hooks
  • Loading branch information
aldesantis authored Mar 26, 2020
2 parents c55539b + 90bf905 commit 16dc131
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/app/models/spree/reimbursement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 16dc131

Please sign in to comment.