Class: ActiveMerchant::Billing::IxopayGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/ixopay.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 CreditCardFormatting

#expdate, #format

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ IxopayGateway

Returns a new instance of IxopayGateway.



17
18
19
20
21
# File 'lib/active_merchant/billing/gateways/ixopay.rb', line 17

def initialize(options = {})
  requires!(options, :username, :password, :secret, :api_key)
  @secret = options[:secret]
  super
end

Instance Method Details

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



32
33
34
35
36
37
38
39
# File 'lib/active_merchant/billing/gateways/ixopay.rb', line 32

def authorize(money, payment_method, options = {})
  request = build_xml_request do |xml|
    add_card_data(xml, payment_method)
    add_preauth(xml, money, options)
  end

  commit(request)
end

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



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

def capture(money, authorization, options = {})
  request = build_xml_request do |xml|
    add_capture(xml, money, authorization, options)
  end

  commit(request)
end

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



23
24
25
26
27
28
29
30
# File 'lib/active_merchant/billing/gateways/ixopay.rb', line 23

def purchase(money, payment_method, options = {})
  request = build_xml_request do |xml|
    add_card_data(xml, payment_method)
    add_debit(xml, money, options)
  end

  commit(request)
end

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



49
50
51
52
53
54
55
# File 'lib/active_merchant/billing/gateways/ixopay.rb', line 49

def refund(money, authorization, options = {})
  request = build_xml_request do |xml|
    add_refund(xml, money, authorization, options)
  end

  commit(request)
end

#scrub(transcript) ⇒ Object



76
77
78
79
80
81
82
83
84
# File 'lib/active_merchant/billing/gateways/ixopay.rb', line 76

def scrub(transcript)
  clean_transcript = remove_invalid_utf_8_byte_sequences(transcript)

  clean_transcript.
    gsub(%r((Authorization: Gateway )(.*)(:)), '\1[FILTERED]\3').
    gsub(%r((<password>)(.*)(</password>)), '\1[FILTERED]\3').
    gsub(%r((<pan>)(.*)(</pan>)), '\1[FILTERED]\3').
    gsub(%r((<cvv>)\d+(</cvv>)), '\1[FILTERED]\2')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


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

def supports_scrubbing?
  true
end

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



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

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) }
  end
end

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



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

def void(authorization, options = {})
  request = build_xml_request do |xml|
    add_void(xml, authorization)
  end

  commit(request)
end