Class: ActiveMerchant::Billing::IveriGateway

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

Constant Summary

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 = {}) ⇒ IveriGateway

Returns a new instance of IveriGateway.



21
22
23
24
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 21

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

Instance Method Details

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



34
35
36
37
38
39
40
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 34

def authorize(money, payment_method, options = {})
  post = build_vxml_request('Authorisation', options) do |xml|
    add_auth_purchase_params(xml, money, payment_method, options)
  end

  commit(post)
end

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



42
43
44
45
46
47
48
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 42

def capture(money, authorization, options = {})
  post = build_vxml_request('Debit', options) do |xml|
    add_authorization(xml, authorization, options)
  end

  commit(post)
end

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



26
27
28
29
30
31
32
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 26

def purchase(money, payment_method, options = {})
  post = build_vxml_request('Debit', options) do |xml|
    add_auth_purchase_params(xml, money, payment_method, options)
  end

  commit(post)
end

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



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

def refund(money, authorization, options = {})
  post = build_vxml_request('Credit', options) do |xml|
    add_amount(xml, money, options)
    add_authorization(xml, authorization, options)
  end

  commit(post)
end

#scrub(transcript) ⇒ Object



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

def scrub(transcript)
  transcript.
    gsub(%r((CertificateID=\\\")[^\\]*), '\1[FILTERED]').
    gsub(%r((<PAN>)[^&]*), '\1[FILTERED]').
    gsub(%r((<CardSecurityCode>)[^&]*), '\1[FILTERED]')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 82

def supports_scrubbing?
  true
end

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



68
69
70
71
72
73
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 68

def verify(credit_card, options = {})
  MultiResponse.run(:use_first_response) do |r|
    r.process { authorize(100, credit_card, options) }
    r.process(:ignore_result) { void(r.authorization, options.merge(reference_type: :authorize)) }
  end
end

#verify_credentialsObject



75
76
77
78
79
80
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 75

def verify_credentials
  void = void('', options)
  return true if void.message == 'Missing OriginalMerchantTrace'

  false
end

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



59
60
61
62
63
64
65
66
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 59

def void(authorization, options = {})
  txn_type = options[:reference_type] == :authorize ? 'AuthorisationReversal' : 'Void'
  post = build_vxml_request(txn_type, options) do |xml|
    add_authorization(xml, authorization, options)
  end

  commit(post)
end