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::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

#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
28
# File 'lib/active_merchant/billing/gateways/ipp.rb', line 24

def initialize(options = {})
  ActiveMerchant.deprecated('IPP gateway is now named Bambora Asia-Pacific')
  requires!(options, :username, :password)
  super
end

Instance Method Details

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


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

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


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

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


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

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


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

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


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

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)

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

def supports_scrubbing?
  true
end