Class: ActiveMerchant::Billing::LoanPaymentProGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/loan_payment_pro.rb

Direct Known Subclasses

LoanPaymentProAchGateway

Constant Summary collapse

RESPONSE_CODE_MAPPING =
{
  1 => 'Customer added successfully.',
  3 => 'Customer removed successfully.',
  4 => 'An error occurred while removing the customer.',
  5 => 'Customer updated successfully.',
  6 => 'An error occurred while updating the customer.',
  7 => 'Customer was retrieved successfully.',
  8 => 'A customer with that token was not found.',
  9 => 'Customer listing successful.',
  10 => 'Payment method was removed successfully.',
  11 => 'An error occurred while removing the payment method.',
  12 => 'A payment method with that token was not  found.',
  13 => 'Payment method updated successfully.',
  14 => 'An error occurred while updating the payment method.',
  15 => 'Payment method retrieved successfully.',
  21 => 'Payment method added successfully.',
  27 => 'Transaction search completed successfully',
  28 => 'An error occurred while searching transactions.',
  30 => 'Payment method listing successful.',
  31 => 'Transaction retrieved sucessfully.',
  32 => 'A transaction with that ID could not be found.',
  41 => 'Transaction summary retrieved successfully.',
  42 => 'Error retrieving transaction summary',
  46 => 'A transaction with that InvoiceId could not be found.',
  56 => 'The operation failed to complete successfully.',
  95 => 'Timeout occurred, transaction not processed.',
  105 => 'Batch report retrieved successfully.',
  198 => 'Invalid transaction key to perform this action',
  254 => 'Portfolio retrieved successfully',
  275 => 'Invalid transaction type',
  276 => 'Batch search failed.',
  376 => 'Pre-Payment created successfully',
  377 => 'An error occurred while creating the pre-payment',
  378 => 'Pre-Payment retrieval successful.',
  379 => 'Invalid pre-payment uniqueId',
  380 => 'An error occurred while retrieving pre-payment information',
  382 => 'An error occurred while retrieving pre-payment information',
  383 => 'Pre-Payment updated successfully',
  384 => 'Invalid pre-payment uniqueId',
  385 => 'An error occurred while updating the pre-payment'
}

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 Gateway

#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #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 = {}) ⇒ LoanPaymentProGateway

Returns a new instance of LoanPaymentProGateway.



56
57
58
59
# File 'lib/active_merchant/billing/gateways/loan_payment_pro.rb', line 56

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

Instance Method Details

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



73
74
75
76
77
78
# File 'lib/active_merchant/billing/gateways/loan_payment_pro.rb', line 73

def authorize(money, payment, options = {})
  return delegate_to_ach(:authorize, money, payment, options) if use_ach_gateway?(payment)

  options[:action] = :authorize
  purchase(money, payment, options)
end

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



80
81
82
# File 'lib/active_merchant/billing/gateways/loan_payment_pro.rb', line 80

def capture(money, authorization, options = {})
  commit(path(:capture, authorization), {})
end

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



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/active_merchant/billing/gateways/loan_payment_pro.rb', line 61

def purchase(money, payment, options = {})
  return delegate_to_ach(:purchase, money, payment, options) if use_ach_gateway?(payment)

  post = {}

  add_invoice(post, money, options)
  add_payment(post, payment)
  add_address(post, payment, options)

  commit(auth_purchase_path(payment, options), post)
end

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



84
85
86
87
88
89
90
91
# File 'lib/active_merchant/billing/gateways/loan_payment_pro.rb', line 84

def refund(money, authorization, options = {})
  return delegate_to_ach(:refund, money, authorization, options) if use_ach_gateway?(authorization)

  transaction_id, invoice_id = authorization.split('|')
  post = { Amount: amount(money), InvoiceId: invoice_id }

  commit(path(:refund, transaction_id), post)
end

#scrub(transcript) ⇒ Object



123
124
125
126
127
128
# File 'lib/active_merchant/billing/gateways/loan_payment_pro.rb', line 123

def scrub(transcript)
  transcript.
    gsub(%r((Transactionkey: )\S+), '\1[FILTERED]').
    gsub(%r((CardNumber=)\d+), '\1[FILTERED]').
    gsub(%r((CardCode=)\d+), '\1[FILTERED]')
end

#store(credit_card, options = {}) ⇒ Object



107
108
109
110
111
112
113
# File 'lib/active_merchant/billing/gateways/loan_payment_pro.rb', line 107

def store(credit_card, options = {})
  post = {}
  add_payment(post, credit_card)
  add_address(post, credit_card, options)

  commit(path(:store), post)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/active_merchant/billing/gateways/loan_payment_pro.rb', line 119

def supports_scrubbing?
  true
end

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



115
116
117
# File 'lib/active_merchant/billing/gateways/loan_payment_pro.rb', line 115

def unstore(authorization, options = {})
  commit(path(:unstore, authorization), {}, :delete)
end

#verify(credit_card, options = {}) ⇒ Object



99
100
101
102
103
104
105
# File 'lib/active_merchant/billing/gateways/loan_payment_pro.rb', line 99

def verify(credit_card, options = {})
  post = {}
  add_payment(post, credit_card)
  add_address(post, credit_card, options)

  commit(path(:verify), post)
end

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



93
94
95
96
97
# File 'lib/active_merchant/billing/gateways/loan_payment_pro.rb', line 93

def void(authorization, options = {})
  return delegate_to_ach(:void, authorization, options) if use_ach_gateway?(authorization)

  commit(path(:void, authorization), {})
end