Sha256: 8be73c299e57bbb7e5e44f75239f84f9f761ae6cb0a99fa106877ba59f09871e

Contents?: true

Size: 698 Bytes

Versions: 17

Compression:

Stored size: 698 Bytes

Contents

module BloomRemit
  module Txns
    module Operations
      class Create < Trailblazer::Operation

        include Model
        model Txn, :create

        contract Contracts::Create

        include Dispatch
        callback :after_create do
          on_change :after_create
        end

        def process(params)
          validate(params[:txn]) do |f|
            f.model.secret = SecureRandom.uuid
            f.save
            dispatch! :after_create
          end
        end

        private

        def after_create(form, opts)
          ActiveRecord::Base.after_transaction do
            PayoutJob.perform_async(form.model.id)
          end
        end

      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bloom_remit-0.13.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.12.1 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.12.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.11.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.10.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.9.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.8.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.7.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.6.1 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.6.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.5.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.4.1 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.4.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.3.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.2.1 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.2.0 app/concepts/bloom_remit/txns/operations/create.rb
bloom_remit-0.1.0 app/concepts/bloom_remit/txns/operations/create.rb