Class: BasecommSdk::BankAccountTransaction

Inherits:
Base
  • Object
show all
Defined in:
lib/basecomm_sdk/bank_account_transaction.rb

Constant Summary collapse

ACCOUNT_TYPE =
{
  xs_bat_account_type_checking: 'CHECKING',
  xs_bat_account_type_savings:  'SAVINGS'
}
TYPE =
{
  xs_bat_type_credit:   'CREDIT',
  xs_bat_type_debit:    'DEBIT',
  xs_bat_type_reversal: 'REVERSAL',
  xs_bat_type_cancel:   'CANCEL'
}
STATUS =
{
  xs_bat_status_created:   'CREATED',
  xs_bat_status_initiated: 'INITIATED',
  xs_bat_status_settled:   'SETTLED',
  xs_bat_status_returned:  'RETURNED',
  xs_bat_status_canceled:  'CANCELED',
  xs_bat_status_failed:    'FAILED',
  xs_bat_status_rejected:  'REJECTED'
}
METHOD =
{
  xs_bat_method_ccd: 'CCD',
  xs_bat_method_ppd: 'PPD',
  xs_bat_method_tel: 'TEL',
  xs_bat_method_web: 'WEB'
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

attr_accessor, attributes, #attributes, #format, #initialize, json_prefix, #messages, #qualified_attributes, #qualified_key, #status_description, #status_name, #to_json

Constructor Details

This class inherits a constructor from BasecommSdk::Base

Instance Attribute Details

#account_nameObject

Returns the value of attribute account_name.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def 
  @account_name
end

#account_numberObject

Returns the value of attribute account_number.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def 
  @account_number
end

#account_typeObject

Returns the value of attribute account_type.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def 
  @account_type
end

#amountObject

Returns the value of attribute amount.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def amount
  @amount
end

#bank_account_tokenObject

Returns the value of attribute bank_account_token.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def 
  @bank_account_token
end

#custom_field1Object

Returns the value of attribute custom_field1.



35
36
37
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 35

def custom_field1
  @custom_field1
end

#custom_field10Object

Returns the value of attribute custom_field10.



35
36
37
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 35

def custom_field10
  @custom_field10
end

#custom_field2Object

Returns the value of attribute custom_field2.



35
36
37
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 35

def custom_field2
  @custom_field2
end

#custom_field3Object

Returns the value of attribute custom_field3.



35
36
37
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 35

def custom_field3
  @custom_field3
end

#custom_field4Object

Returns the value of attribute custom_field4.



35
36
37
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 35

def custom_field4
  @custom_field4
end

#custom_field5Object

Returns the value of attribute custom_field5.



35
36
37
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 35

def custom_field5
  @custom_field5
end

#custom_field6Object

Returns the value of attribute custom_field6.



35
36
37
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 35

def custom_field6
  @custom_field6
end

#custom_field7Object

Returns the value of attribute custom_field7.



35
36
37
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 35

def custom_field7
  @custom_field7
end

#custom_field8Object

Returns the value of attribute custom_field8.



35
36
37
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 35

def custom_field8
  @custom_field8
end

#custom_field9Object

Returns the value of attribute custom_field9.



35
36
37
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 35

def custom_field9
  @custom_field9
end

#effective_dateObject

Returns the value of attribute effective_date.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def effective_date
  @effective_date
end

#idObject

Returns the value of attribute id.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def id
  @id
end

#merchant_transaction_idObject

Returns the value of attribute merchant_transaction_id.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def merchant_transaction_id
  @merchant_transaction_id
end

#methodObject

Returns the value of attribute method.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def method
  @method
end

#micr_dataObject

Returns the value of attribute micr_data.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def micr_data
  @micr_data
end

#recurring_indicatorObject

Returns the value of attribute recurring_indicator.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def recurring_indicator
  @recurring_indicator
end

#return_codeObject

Returns the value of attribute return_code.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def return_code
  @return_code
end

#return_dateObject

Returns the value of attribute return_date.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def return_date
  @return_date
end

#routing_numberObject

Returns the value of attribute routing_number.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def routing_number
  @routing_number
end

#settlement_dateObject

Returns the value of attribute settlement_date.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def settlement_date
  @settlement_date
end

#statusObject

Returns the value of attribute status.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def status
  @status
end

#traceObject

Returns the value of attribute trace.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def trace
  @trace
end

#typeObject

Returns the value of attribute type.



29
30
31
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 29

def type
  @type
end

Class Method Details

.build_from_json(json) ⇒ Object



39
40
41
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 39

def self.build_from_json(json)
  BankAccountTransaction.new(JSON.parse(json).recursively_symbolize_keys!)
end

Instance Method Details

#correction?Boolean

Returns:

  • (Boolean)


48
49
50
51
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 48

def correction?
  return false if return_code.nil?
  status_name == STATUS[:xs_bat_status_returned] && !return_code.match(/^C/).nil?
end

#failed?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 62

def failed?
  status_name == STATUS[:xs_bat_status_failed] ? true : false
end

#json_prefixObject



44
45
46
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 44

def json_prefix
  :bank_account_transaction
end

#returned?Boolean

Returns:

  • (Boolean)


53
54
55
56
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 53

def returned?
  return false if correction?
  status_name == STATUS[:xs_bat_status_returned] && !return_code.match(/^R/).nil?
end

#settled?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 58

def settled?
  status_name == STATUS[:xs_bat_status_settled] && !settlement_date.nil?
end

#status_dateObject



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/basecomm_sdk/bank_account_transaction.rb', line 66

def status_date
  case status_name
    when STATUS[:xs_bat_status_returned]
      return_date
    when STATUS[:xs_bat_status_settled]
      settlement_date
    when STATUS[:xs_bat_status_initiated]
      effective_date
    else
      Time.now.strftime('%m/%d/%Y %H:%M:%S')
  end
end