Class: ActiveMerchant::Billing::NmiGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::NmiGateway
show all
- Includes:
- Empty
- Defined in:
- lib/active_merchant/billing/gateways/nmi.rb
Constant Summary
collapse
- DUP_WINDOW_DEPRECATION_MESSAGE =
'The class-level duplicate_window variable is deprecated. Please use the :dup_seconds transaction option instead.'
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
#options
Class Method Summary
collapse
Instance Method Summary
collapse
-
#authorize(amount, payment_method, options = {}) ⇒ Object
-
#capture(amount, authorization, options = {}) ⇒ Object
-
#credit(amount, payment_method, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ NmiGateway
constructor
A new instance of NmiGateway.
-
#purchase(amount, payment_method, options = {}) ⇒ Object
-
#refund(amount, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(payment_method, options = {}) ⇒ Object
-
#supports_network_tokenization? ⇒ Boolean
-
#supports_scrubbing? ⇒ Boolean
-
#verify(payment_method, options = {}) ⇒ Object
-
#verify_credentials ⇒ 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?, #test?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ NmiGateway
Returns a new instance of NmiGateway.
25
26
27
28
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 25
def initialize(options = {})
requires!(options, :login, :password)
super
end
|
Class Method Details
.duplicate_window ⇒ Object
21
22
23
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 21
def self.duplicate_window
instance_variable_defined?(:@dup_seconds) ? @dup_seconds : nil
end
|
.duplicate_window=(seconds) ⇒ Object
Instance Method Details
#authorize(amount, payment_method, options = {}) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 43
def authorize(amount, payment_method, options={})
post = {}
add_invoice(post, amount, options)
add_payment_method(post, payment_method, options)
add_stored_credential(post, options)
add_customer_data(post, options)
add_vendor_data(post, options)
add_merchant_defined_fields(post, options)
add_level3_fields(post, options)
commit('auth', post)
end
|
#capture(amount, authorization, options = {}) ⇒ Object
56
57
58
59
60
61
62
63
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 56
def capture(amount, authorization, options={})
post = {}
add_invoice(post, amount, options)
add_reference(post, authorization)
add_merchant_defined_fields(post, options)
commit('capture', post)
end
|
#credit(amount, payment_method, options = {}) ⇒ Object
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 82
def credit(amount, payment_method, options={})
post = {}
add_invoice(post, amount, options)
add_payment_method(post, payment_method, options)
add_customer_data(post, options)
add_vendor_data(post, options)
add_level3_fields(post, options)
commit('credit', post)
end
|
#purchase(amount, payment_method, options = {}) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 30
def purchase(amount, payment_method, options={})
post = {}
add_invoice(post, amount, options)
add_payment_method(post, payment_method, options)
add_stored_credential(post, options)
add_customer_data(post, options)
add_vendor_data(post, options)
add_merchant_defined_fields(post, options)
add_level3_fields(post, options)
commit('sale', post)
end
|
#refund(amount, authorization, options = {}) ⇒ Object
73
74
75
76
77
78
79
80
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 73
def refund(amount, authorization, options={})
post = {}
add_invoice(post, amount, options)
add_reference(post, authorization)
add_payment_type(post, authorization)
commit('refund', post)
end
|
#scrub(transcript) ⇒ Object
124
125
126
127
128
129
130
131
132
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 124
def scrub(transcript)
transcript.
gsub(%r((password=)[^&\n]*), '\1[FILTERED]').
gsub(%r((ccnumber=)\d+), '\1[FILTERED]').
gsub(%r((cvv=)\d+), '\1[FILTERED]').
gsub(%r((checkaba=)\d+), '\1[FILTERED]').
gsub(%r((checkaccount=)\d+), '\1[FILTERED]').
gsub(%r((cryptogram=)[^&]+(&?)), '\1[FILTERED]\2')
end
|
#store(payment_method, options = {}) ⇒ Object
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 104
def store(payment_method, options = {})
post = {}
add_invoice(post, nil, options)
add_payment_method(post, payment_method, options)
add_customer_data(post, options)
add_vendor_data(post, options)
add_merchant_defined_fields(post, options)
commit('add_customer', post)
end
|
#supports_network_tokenization? ⇒ Boolean
134
135
136
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 134
def supports_network_tokenization?
true
end
|
#supports_scrubbing? ⇒ Boolean
120
121
122
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 120
def supports_scrubbing?
true
end
|
#verify(payment_method, options = {}) ⇒ Object
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 93
def verify(payment_method, options={})
post = {}
add_payment_method(post, payment_method, options)
add_customer_data(post, options)
add_vendor_data(post, options)
add_merchant_defined_fields(post, options)
add_level3_fields(post, options)
commit('validate', post)
end
|
#verify_credentials ⇒ Object
115
116
117
118
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 115
def verify_credentials
response = void('0')
response.message != 'Authentication Failed'
end
|
#void(authorization, options = {}) ⇒ Object
65
66
67
68
69
70
71
|
# File 'lib/active_merchant/billing/gateways/nmi.rb', line 65
def void(authorization, options={})
post = {}
add_reference(post, authorization)
add_payment_type(post, authorization)
commit('void', post)
end
|