Class: Spree::CreditCards::Destroy Deprecated

Inherits:
Object
  • Object
show all
Includes:
ServiceModule::Base
Defined in:
app/services/spree/credit_cards/destroy.rb

Overview

Deprecated.

Use card.destroy directly instead. Payment cleanup is now handled by the before_destroy callback in Spree::PaymentSourceConcern. This service will be removed in Spree 6.0.

Instance Method Summary collapse

Methods included from ServiceModule::Base

prepended

Instance Method Details

#call(card:) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/services/spree/credit_cards/destroy.rb', line 9

def call(card:)
  Spree::Deprecation.warn(
    "#{self.class.name} is deprecated and will be removed in Spree 6.0. " \
    'Use card.destroy directly instead. Payment cleanup is now handled ' \
    'automatically by the before_destroy callback in PaymentSourceConcern.',
    caller
  )

  if card.destroy
    success(card: card)
  else
    failure(card.errors.full_messages.to_sentence)
  end
end