Class: Gold::AcceptOrDeclineTermsOp

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

Overview

Mark a store as having accepted/denied our Terms of Service.

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, accepted) ⇒ AcceptOrDeclineTermsOp

Returns a new instance of AcceptOrDeclineTermsOp.



11
12
13
14
# File 'app/operations/gold/accept_or_decline_terms_op.rb', line 11

def initialize(billing, accepted)
  @billing = billing
  @accepted = accepted
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
# File 'app/operations/gold/accept_or_decline_terms_op.rb', line 16

def call
  if @accepted
    @billing.transition_to!(:accepted_terms)

    return AcceptedTerms.new
  end

  DeclinedTerms.new
end