Class: ActiveMerchant::Billing::IatsPaymentsGateway

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

Constant Summary collapse

ACTIONS =
{
  purchase: 'ProcessCreditCard',
  purchase_check: 'ProcessACHEFT',
  purchase_customer_code: 'ProcessCreditCardWithCustomerCode',
  refund: 'ProcessCreditCardRefundWithTransactionId',
  refund_check: 'ProcessACHEFTRefundWithTransactionId',
  store: 'CreateCreditCardCustomerCode',
  unstore: 'DeleteCustomerCode'
}

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 CreditCardFormatting

#format, #strftime_yyyymm

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ IatsPaymentsGateway

Returns a new instance of IatsPaymentsGateway.



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/active_merchant/billing/gateways/iats_payments.rb', line 26

def initialize(options = {})
  if options[:login]
    ActiveMerchant.deprecated("The 'login' option is deprecated in favor of 'agent_code' and will be removed in a future version.")
    options[:agent_code] = options[:login]
  end

  options[:region] = 'na' unless options[:region]

  requires!(options, :agent_code, :password, :region)
  super
end

Instance Method Details

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



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

def purchase(money, payment, options = {})
  post = {}
  add_invoice(post, money, options)
  add_payment(post, payment)
  add_address(post, options)
  add_ip(post, options)
  add_description(post, options)
  add_customer_details(post, options)

  commit(determine_purchase_type(payment), post)
end

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



50
51
52
53
54
55
56
57
58
59
# File 'lib/active_merchant/billing/gateways/iats_payments.rb', line 50

def refund(money, authorization, options = {})
  post = {}
  transaction_id, payment_type = split_authorization(authorization)
  post[:transaction_id] = transaction_id
  add_invoice(post, -money, options)
  add_ip(post, options)
  add_description(post, options)

  commit((payment_type == 'check' ? :refund_check : :refund), post)
end

#scrub(transcript) ⇒ Object



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

def scrub(transcript)
  transcript.
    gsub(%r((<agentCode>).+(</agentCode>)), '\1[FILTERED]\2').
    gsub(%r((<password>).+(</password>)), '\1[FILTERED]\2').
    gsub(%r((<creditCardNum>).+(</creditCardNum>)), '\1[FILTERED]\2').
    gsub(%r((<cvv2>).+(</cvv2>)), '\1[FILTERED]\2').
    gsub(%r((<accountNum>).+(</accountNum>)), '\1[FILTERED]\2')
end

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



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

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

  commit(:store, post)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


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

def supports_scrubbing?
  true
end

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



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

def unstore(authorization, options = {})
  post = {}
  post[:customer_code] = authorization
  add_ip(post, options)

  commit(:unstore, post)
end