Class: ActiveMerchant::Billing::LoanPaymentProAchGateway

Inherits:
LoanPaymentProGateway show all
Defined in:
lib/active_merchant/billing/gateways/loan_payment_pro_ach.rb

Constant Summary collapse

API_VERSION =
'1.4.2.36'.freeze

Constants inherited from LoanPaymentProGateway

ActiveMerchant::Billing::LoanPaymentProGateway::RESPONSE_CODE_MAPPING

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from LoanPaymentProGateway

#capture, #scrub, #store, #supports_scrubbing?, #unstore, #verify

Methods inherited from Gateway

#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #scrub, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from Versionable

#fetch_version, included

Methods included from CreditCardFormatting

#expdate, #format, #strftime_yyyymm, #strftime_yyyymmdd_last_day

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ LoanPaymentProAchGateway

Returns a new instance of LoanPaymentProAchGateway.



9
10
11
12
# File 'lib/active_merchant/billing/gateways/loan_payment_pro_ach.rb', line 9

def initialize(options = {})
  requires!(options, :login, :password)
  super
end

Instance Method Details

#authorize(money, bank_account, options = {}) ⇒ Object



27
28
29
# File 'lib/active_merchant/billing/gateways/loan_payment_pro_ach.rb', line 27

def authorize(money, , options = {})
  purchase(money, , options.merge(method: :Authorize))
end

#purchase(money, bank_account, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/active_merchant/billing/gateways/loan_payment_pro_ach.rb', line 14

def purchase(money, , options = {})
  post = {
    Method: options.delete(:method) || :Debit,
    ReferenceNumber: options[:order_id] || SecureRandom.uuid,
    Name: .name,
    Amount: amount(money),
    RoutingNumber: .routing_number,
    AccountNumber: .
  }

  commit(post)
end

#refund(money, authorization, options = {}) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/active_merchant/billing/gateways/loan_payment_pro_ach.rb', line 39

def refund(money, authorization, options = {})
  post = {
    Method: :Refund,
    TransactionId: authorization.to_s.split('|').first,
    Amount: amount(money)
  }
  commit(post)
end

#void(authorization, options = {}) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/active_merchant/billing/gateways/loan_payment_pro_ach.rb', line 31

def void(authorization, options = {})
  post = {
    Method: :Cancel,
    TransactionId: authorization.to_s.split('|').first
  }
  commit(post)
end