Sha256: cbabbfc801c33c889c60dd1e2bf7cee411d730543c2374133a6a79e17eebf700

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 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

1 entries across 1 versions & 1 rubygems

Version Path
solidus_subscriptions-alpha-0.0.4 app/models/solidus_subscriptions/payment_failed_dispatcher.rb