Sha256: 4abedb38becfccbed162bd79c4bfbd57cedf9de4ed8eb4a6d859913b65827c9b

Contents?: true

Size: 579 Bytes

Versions: 4

Compression:

Stored size: 579 Bytes

Contents

# This service class is intented to provide callback behaviour to handle
# the case where a subscription order cannot be processed because a payment
# failed
module SolidusSubscriptions
  class PaymentFailedDispatcher < Dispatcher
    def dispatch
      order.touch :completed_at
      order.cancel!

      installments.each { |i| i.payment_failed!(order) }
      super
    end

    private

    def message
      "
      The following installments could not be processed due to payment
      authorization failure: #{installments.map(&:id).join(', ')}
      "
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_subscriptions-alpha-0.0.5 app/models/solidus_subscriptions/payment_failed_dispatcher.rb
solidus_subscriptions-alpha-0.0.3 app/models/solidus_subscriptions/payment_failed_dispatcher.rb
solidus_subscriptions-alpha-0.0.2 app/models/solidus_subscriptions/payment_failed_dispatcher.rb
solidus_subscriptions-alpha-0.0.1 app/models/solidus_subscriptions/payment_failed_dispatcher.rb