Class: Gold::CleanupOp

Inherits:
Object
  • Object
show all
Includes:
Outcomes
Defined in:
app/operations/gold/cleanup_op.rb

Overview

Clean up resources associated with a store after a merchant has uninstalled and a sufficient amount of time has passed.

Constant Summary

Constants included from Outcomes

Outcomes::AcceptedCharge, Outcomes::AcceptedTerms, Outcomes::ActiveCharge, Outcomes::CannotApplyDiscount, Outcomes::CannotIssueCredit, Outcomes::CannotProcessCharge, Outcomes::CannotSelectTier, Outcomes::ChargeNeeded, Outcomes::ChargeNotNeeded, Outcomes::DeclinedCharge, Outcomes::DeclinedTerms, Outcomes::ExpiredCharge, Outcomes::FrozenCharge, Outcomes::MismatchCharge, Outcomes::MissingCharge, Outcomes::PendingCharge, Outcomes::SameDiscount, Outcomes::SameTier, Outcomes::TierApplied, Outcomes::TierNotFound, Outcomes::Uninstalled

Instance Method Summary collapse

Constructor Details

#initialize(billing) ⇒ CleanupOp

Returns a new instance of CleanupOp.



7
8
9
# File 'app/operations/gold/cleanup_op.rb', line 7

def initialize(billing)
  @billing = billing
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
# File 'app/operations/gold/cleanup_op.rb', line 11

def call
  @billing.transition_to_or_stay_in!(:cleanup)

  Gold.configuration.on_cleanup&.call(@billing)

  @billing.transition_to!(:done)
  Success.new
end