Class: Gold::UninstallOp

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

Overview

Invoked when a shop has uninstalled this app.

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) ⇒ UninstallOp

Returns a new instance of UninstallOp.



6
7
8
# File 'app/operations/gold/uninstall_op.rb', line 6

def initialize(billing)
  @billing = billing
end

Instance Method Details

#callObject



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

def call
  return Success.new if @billing.current_state == :uninstalled

  @billing.transition_to_or_stay_in!(:marked_as_uninstalled)
  @billing.transition_to!(:uninstalled)
  Gold.configuration.on_uninstall&.call(@billing)

  Success.new
end