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::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?

Methods included from CreditCardFormatting

#expdate, #format

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


16
17
18
19
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 16

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

Instance Method Details

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


29
30
31
32
33
34
35
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 29

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


37
38
39
40
41
42
43
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 37

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


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

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


45
46
47
48
49
50
51
52
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 45

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


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

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)

72
73
74
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 72

def supports_scrubbing?
  true
end

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


62
63
64
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 62

def verify(credit_card, options={})
  authorize(0, credit_card, options)
end

#verify_credentialsObject


66
67
68
69
70
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 66

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

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


54
55
56
57
58
59
60
# File 'lib/active_merchant/billing/gateways/iveri.rb', line 54

def void(authorization, options={})
  post = build_vxml_request('Void', options) do |xml|
    add_authorization(xml, authorization, options)
  end

  commit(post)
end