Class: Bluepay::BankAccount

Inherits:
Object
  • Object
show all
Includes:
Parameters
Defined in:
lib/bluepay/bank_account.rb

Constant Summary

Constants included from Parameters

Parameters::BOOLEAN_CONVERTER, Parameters::DEFAULT_CONVERTER

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Parameters

#bluepay_params, #converted_params, included, #params

Constructor Details

#initialize(params = {}) ⇒ BankAccount

Returns a new instance of BankAccount.



7
8
9
10
# File 'lib/bluepay/bank_account.rb', line 7

def initialize(params={})
  self.params = params
  self.params[:payment_type] = 'ACH'
end

Instance Attribute Details

#authObject (readonly)

Returns the value of attribute auth.



5
6
7
# File 'lib/bluepay/bank_account.rb', line 5

def auth
  @auth
end

Instance Method Details

#save!Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/bluepay/bank_account.rb', line 12

def save!
  return self if @auth && @auth.trans_id && @auth.trans_id.length > 0

  @auth = Bluepay::Auth.new(
    amount: "0.00",
    source: self
  ).create!

  _params = @auth.to_h
  (class << self; self; end).class_eval do
    _params.each { |k, v| define_method(k) { v } }
  end
  self
end