Class: AchClient::AchWorks

Inherits:
Object
  • Object
show all
Includes:
SoapProvider
Defined in:
lib/ach_client/providers/soap/ach_works/ach_works.rb,
lib/ach_client/providers/soap/ach_works/ach_batch.rb,
lib/ach_client/providers/soap/ach_works/company_info.rb,
lib/ach_client/providers/soap/ach_works/date_formatter.rb,
lib/ach_client/providers/soap/ach_works/ach_transaction.rb,
lib/ach_client/providers/soap/ach_works/ach_status_checker.rb,
lib/ach_client/providers/soap/ach_works/account_type_transformer.rb,
lib/ach_client/providers/soap/ach_works/response_record_processor.rb,
lib/ach_client/providers/soap/ach_works/correction_details_processor.rb,
lib/ach_client/providers/soap/ach_works/transaction_type_transformer.rb

Overview

Namespace class for all things AchWorks Contains class attributes with various initialization settings

Defined Under Namespace

Classes: AccountTypeTransformer, AchBatch, AchStatusChecker, AchTransaction, CompanyInfo, CorrectionDetailsProcessor, DateFormatter, ResponseRecordProcessor, TransactionTypeTransformer

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.wrap_request(method:, message:, path:) ⇒ Hash

Handles making request to AchWorks. If the request was successful, returns the response If it is unsuccessful, tries to find the error message and raises it in an exception status field) within the response hash. For example, if you have a burrito but only care about the guacomole, the path to the hash with the guac would be: [:aluminum_foil, :tortilla] the response was successful.

Parameters:

  • method (Symbol)

    SOAP operation to call against AchWorks

  • message (Hash)

    The request body

  • path (Array<Symbol>)

    Path to the attributes we care about (and the

Returns:

  • (Hash)

    The hash the input path led to within the response hash, if



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ach_client/providers/soap/ach_works/ach_works.rb', line 36

def self.wrap_request(method:, message:, path:)
  response = self.request(method: method, message: message)
  if response.success?
    response = path.reduce(response.body) {|r, node| r[node] }
    if response[:status] == 'SUCCESS'
      # It worked! Return the response hash
      response
    else
      # AchWorks likes to keep things interesting by sometimes putting
      # the error messages in the details field instead of errors.
      raise response.try(:[], :errors)
                    .try(:[], :string)
                    .try(:join, ', ') ||
            response[:details]
    end
  else
    # This would normally raise an exception on its own, but just in case
    raise "#{method} failed due to unknown SOAP fault"
  end
end

Instance Method Details

#companyString

Returns Your user id string, used as a username.

Returns:

  • (String)

    Your user id string, used as a username



16
# File 'lib/ach_client/providers/soap/ach_works/ach_works.rb', line 16

class_attribute :company

#company_keyString

Returns A key that they give you used as a password.

Returns:

  • (String)

    A key that they give you used as a password



13
# File 'lib/ach_client/providers/soap/ach_works/ach_works.rb', line 13

class_attribute :company_key

#loc_i_dString

Returns Another Arbitrary 4 letter code AchWorks gives you…

Returns:

  • (String)

    Another Arbitrary 4 letter code AchWorks gives you…



19
# File 'lib/ach_client/providers/soap/ach_works/ach_works.rb', line 19

class_attribute :loc_i_d

#s_s_sString

Returns Arbitrary 3 letter code AchWorks gives your company.

Returns:

  • (String)

    Arbitrary 3 letter code AchWorks gives your company



22
# File 'lib/ach_client/providers/soap/ach_works/ach_works.rb', line 22

class_attribute :s_s_s