Class: AchClient::AchWorks::AchTransaction
- Inherits:
-
AchClient::Abstract::AchTransaction
- Object
- AchClient::Abstract::AchTransaction
- AchClient::AchWorks::AchTransaction
- Defined in:
- lib/ach_client/providers/soap/ach_works/ach_transaction.rb
Overview
AchWorks implementation for AchTransaction
Constant Summary collapse
- MAX_MERCHANT_NAME_LENGTH =
Only allows for merchant length of less than or equal to 22.
22.freeze
Instance Attribute Summary collapse
-
#customer_id ⇒ Object
readonly
Returns the value of attribute customer_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#do_send ⇒ String
Send this transaction individually to AchWorks.
-
#front_end_trace ⇒ String
AchWorks Ach needs a “FrontEndTrace”, for each ACH transaction.
-
#to_hash ⇒ Hash
AchWorks.
Methods inherited from AchClient::Abstract::AchTransaction
#credit?, #debit?, #initialize, #send, #sendable?
Constructor Details
This class inherits a constructor from AchClient::Abstract::AchTransaction
Instance Attribute Details
#customer_id ⇒ Object (readonly)
Returns the value of attribute customer_id.
17 18 19 |
# File 'lib/ach_client/providers/soap/ach_works/ach_transaction.rb', line 17 def customer_id @customer_id end |
Class Method Details
.arguments ⇒ Object
13 14 15 |
# File 'lib/ach_client/providers/soap/ach_works/ach_transaction.rb', line 13 def self.arguments super + [:customer_id] end |
Instance Method Details
#do_send ⇒ String
Send this transaction individually to AchWorks
21 22 23 24 25 26 27 28 29 |
# File 'lib/ach_client/providers/soap/ach_works/ach_transaction.rb', line 21 def do_send AchClient::AchWorks.wrap_request( method: :send_ach_trans, message: AchClient::AchWorks::CompanyInfo.build.to_hash.merge({ InpACHTransRecord: self.to_hash }), path: [:send_ach_trans_response, :send_ach_trans_result] )[:front_end_trace][1..-1] end |
#front_end_trace ⇒ String
AchWorks Ach needs a “FrontEndTrace”, for each ACH transaction. These can be used to track the processing of the ACH after it has been submitted. You can use the id of your Ach record It should be unique per ACH The consumer is responsible for ensuring the uniqueness of this value
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/ach_client/providers/soap/ach_works/ach_transaction.rb', line 69 def front_end_trace # I want to stop this before it goes through because AchWorks might # just truncate the value, which could result in lost Achs. if external_ach_id.length > 11 raise 'AchWorks requires a FrontEndTrace of 12 chars or less' else # The front end trace MUST NOT start with a W. # Our front end trace starts with a Z. # The letter Z is not the letter W. "Z#{external_ach_id}" end end |
#to_hash ⇒ Hash
AchWorks
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ach_client/providers/soap/ach_works/ach_transaction.rb', line 34 def to_hash { SSS: AchClient::AchWorks.s_s_s, LocID: AchClient::AchWorks.loc_i_d, FrontEndTrace: front_end_trace, CustomerName: merchant_name[0..(MAX_MERCHANT_NAME_LENGTH-1)], CustomerRoutingNo: routing_number.to_s, CustomerAcctNo: account_number.to_s, OriginatorName: originator_name.try(:first, 16), TransactionCode: sec_code, CustTransType: AchClient::AchWorks::TransactionTypeTransformer.serialize_to_provider_value( transaction_type ), CustomerID: customer_id, CustomerAcctType: AchClient::AchWorks::AccountTypeTransformer.serialize_to_provider_value( self.account_type ), TransAmount: amount, CheckOrTransDate: DateFormatter.format(effective_entry_date), EffectiveDate: DateFormatter.format(effective_entry_date), Memo: memo.try(:first, 10), OpCode: 'S', # Check this AccountSet: '1' } end |