Class: ActiveMerchant::Billing::IpgGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::IpgGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/ipg.rb
Constant Summary
collapse
- CURRENCY_CODES =
{
'ARS' => '032'
}
- ACTION_REQUEST_ITEMS =
%w(vault unstore)
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
-
#authorize(money, payment, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ IpgGateway
constructor
A new instance of IpgGateway.
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(credit_card, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#unstore(hosted_data_id) ⇒ Object
-
#verify(credit_card, options = {}) ⇒ Object
-
#void(authorization, options = {}) ⇒ Object
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?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ IpgGateway
Returns a new instance of IpgGateway.
20
21
22
23
24
25
|
# File 'lib/active_merchant/billing/gateways/ipg.rb', line 20
def initialize(options = {})
requires!(options, :store_id, :user_id, :password, :pem, :pem_password)
@credentials = options
@hosted_data_id = nil
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
33
34
35
36
37
|
# File 'lib/active_merchant/billing/gateways/ipg.rb', line 33
def authorize(money, payment, options = {})
xml = build_purchase_and_authorize_request(money, payment, options)
commit('preAuth', xml)
end
|
#capture(money, authorization, options = {}) ⇒ Object
39
40
41
42
43
|
# File 'lib/active_merchant/billing/gateways/ipg.rb', line 39
def capture(money, authorization, options = {})
xml = build_capture_and_refund_request(money, authorization, options)
commit('postAuth', xml)
end
|
#purchase(money, payment, options = {}) ⇒ Object
27
28
29
30
31
|
# File 'lib/active_merchant/billing/gateways/ipg.rb', line 27
def purchase(money, payment, options = {})
xml = build_purchase_and_authorize_request(money, payment, options)
commit('sale', xml)
end
|
#refund(money, authorization, options = {}) ⇒ Object
45
46
47
48
49
|
# File 'lib/active_merchant/billing/gateways/ipg.rb', line 45
def refund(money, authorization, options = {})
xml = build_capture_and_refund_request(money, authorization, options)
commit('return', xml)
end
|
#scrub(transcript) ⇒ Object
85
86
87
88
89
90
91
|
# File 'lib/active_merchant/billing/gateways/ipg.rb', line 85
def scrub(transcript)
transcript.
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
gsub(%r((<v1:CardNumber>).+(</v1:CardNumber>)), '\1[FILTERED]\2').
gsub(%r((<v1:CardCodeValue>).+(</v1:CardCodeValue>)), '\1[FILTERED]\2').
gsub(%r((<v1:StoreId>).+(</v1:StoreId>)), '\1[FILTERED]\2')
end
|
#store(credit_card, options = {}) ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/active_merchant/billing/gateways/ipg.rb', line 58
def store(credit_card, options = {})
@hosted_data_id = options[:hosted_data_id] || generate_unique_id
xml = Builder::XmlMarkup.new(indent: 2)
add_storage_item(xml, credit_card, options)
commit('vault', xml)
end
|
#supports_scrubbing? ⇒ Boolean
81
82
83
|
# File 'lib/active_merchant/billing/gateways/ipg.rb', line 81
def supports_scrubbing?
true
end
|
#unstore(hosted_data_id) ⇒ Object
66
67
68
69
70
71
|
# File 'lib/active_merchant/billing/gateways/ipg.rb', line 66
def unstore(hosted_data_id)
xml = Builder::XmlMarkup.new(indent: 2)
add_unstore_item(xml, hosted_data_id)
commit('unstore', xml)
end
|
#verify(credit_card, options = {}) ⇒ Object
73
74
75
76
77
78
79
|
# File 'lib/active_merchant/billing/gateways/ipg.rb', line 73
def verify(credit_card, options = {})
options[:currency] = self.default_currency unless options[:currency] && !options[:currency].empty?
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
51
52
53
54
55
56
|
# File 'lib/active_merchant/billing/gateways/ipg.rb', line 51
def void(authorization, options = {})
xml = Builder::XmlMarkup.new(indent: 2)
add_transaction_details(xml, options.merge!({ order_id: authorization }))
commit('void', xml)
end
|