Class: ActiveMerchant::Billing::IppGateway

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

Constant Summary collapse

STANDARD_ERROR_CODE_MAPPING =
{
  "05" => STANDARD_ERROR_CODE[:card_declined],
  "06" => STANDARD_ERROR_CODE[:processing_error],
  "14" => STANDARD_ERROR_CODE[:invalid_number],
  "54" => STANDARD_ERROR_CODE[:expired_card],
}

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, 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, non_fractional_currency?, #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 = {}) ⇒ IppGateway

Returns a new instance of IppGateway.



24
25
26
27
# File 'lib/active_merchant/billing/gateways/ipp.rb', line 24

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

Instance Method Details

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



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/active_merchant/billing/gateways/ipp.rb', line 42

def authorize(money, payment, options={})
  commit("SubmitSinglePayment") do |xml|
    xml.Transaction do
      xml.CustRef options[:order_id]
      add_amount(xml, money)
      xml.TrnType "2"
      add_credit_card(xml, payment)
      add_credentials(xml)
      xml.TrnSource options[:ip]
    end
  end
end

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



55
56
57
58
59
60
61
62
63
# File 'lib/active_merchant/billing/gateways/ipp.rb', line 55

def capture(money, authorization, options={})
  commit("SubmitSingleCapture") do |xml|
    xml.Capture do
      xml.Receipt authorization
      add_amount(xml, money)
      add_credentials(xml)
    end
  end
end

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



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/active_merchant/billing/gateways/ipp.rb', line 29

def purchase(money, payment, options={})
  commit("SubmitSinglePayment") do |xml|
    xml.Transaction do
      xml.CustRef options[:order_id]
      add_amount(xml, money)
      xml.TrnType "1"
      add_credit_card(xml, payment)
      add_credentials(xml)
      xml.TrnSource options[:ip]
    end
  end
end

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



65
66
67
68
69
70
71
72
73
# File 'lib/active_merchant/billing/gateways/ipp.rb', line 65

def refund(money, authorization, options={})
  commit("SubmitSingleRefund") do |xml|
    xml.Refund do
      xml.Receipt authorization
      add_amount(xml, money)
      add_credentials(xml)
    end
  end
end

#scrub(transcript) ⇒ Object



79
80
81
82
83
84
# File 'lib/active_merchant/billing/gateways/ipp.rb', line 79

def scrub(transcript)
  transcript.
    gsub(%r((<CardNumber>)[^<]+(<))i, '\1[FILTERED]\2').
    gsub(%r((<CVN>)[^<]+(<))i, '\1[FILTERED]\2').
    gsub(%r((<Password>)[^<]+(<))i, '\1[FILTERED]\2')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/active_merchant/billing/gateways/ipp.rb', line 75

def supports_scrubbing?
  true
end