Class: BloomRemit::CreateTxn

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
app/services/bloom_remit/create_txn.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(opts) ⇒ Object



23
24
25
26
27
# File 'app/services/bloom_remit/create_txn.rb', line 23

def self.call(opts)
  create_txn = self.new(opts)
  fail ArgumentError, create_txn.errors.full_messages if create_txn.invalid?
  create_txn.()
end

Instance Method Details

#callObject



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/services/bloom_remit/create_txn.rb', line 29

def call
  ::BloomRemit::Txns::Operations::Create.(txn: {
    sender_id: sender.id,
    sender_type: sender.class.base_class.name,
    amount: amount,
    account_name: ,
    account_id: ,
    target_slug: target_slug,
    owner_id: owner.id,
    owner_type: owner.class.base_class.name,
    external_id: external_id,
  })
end