Sha256: 8cfdf3bf63b6e8cdcda11c3f2ba9b4a3163814b6a454c50a48b6f711202492ce
Contents?: true
Size: 994 Bytes
Versions: 6
Compression:
Stored size: 994 Bytes
Contents
module BloomRemit module Txns module Operations class Update < Trailblazer::Operation include Model model Txn, :update contract Contracts::Update include Callback callback :after_update do on_change :after_update end def process(params) validate(params[:txn]) do |f| if f.save dispatch! :after_update end end end private def setup_params!(params) params[:txn] ||= {} params[:txn].merge!( status: params[:status], secret: params[:secret], ) end def model!(params) Txn.find_by!(id: params[:id], secret: params[:secret]) end def after_update(form, opts) ActiveRecord::Base.after_transaction do OnUpdateJob.perform_async(form.model.id, opts[:params][:txn]) end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems