Class: ActiveMerchant::Billing::Latitude19Gateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::Latitude19Gateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/latitude19.rb
Constant Summary
collapse
- RESPONSE_CODE_MAPPING =
{
'100' => 'Approved',
'101' => 'Local duplicate detected',
'102' => 'Accepted local capture with no match',
'103' => 'Auth succeeded but capture failed',
'104' => 'Auth succeeded but failed to save info',
'200' => STANDARD_ERROR_CODE[:card_declined],
'300' => 'Processor reject',
'301' => 'Local reject on user/password',
'302' => 'Local reject',
'303' => 'Processor unknown response',
'304' => 'Error parsing processor response',
'305' => 'Processor auth succeeded but settle failed',
'306' => 'Processor auth succeeded settle status unknown',
'307' => 'Processor settle status unknown',
'308' => 'Processor duplicate',
'400' => 'Not submitted',
'401' => 'Terminated before request submitted',
'402' => 'Local server busy',
'500' => 'Submitted not returned',
'501' => 'Terminated before response returned',
'502' => 'Processor returned timeout status',
'600' => 'Failed local capture with no match',
'601' => 'Failed local capture',
'700' => 'Failed local void (not in capture file)',
'701' => 'Failed local void',
'800' => 'Failed local refund (not authorized)',
'801' => 'Failed local refund'
}
- BRAND_MAP =
{
'master' => 'MC',
'visa' => 'VI',
'american_express' => 'AX',
'discover' => 'DS',
'diners_club' => 'DC',
'jcb' => 'JC'
}
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(amount, payment_method, options = {}) ⇒ Object
-
#capture(amount, authorization, options = {}) ⇒ Object
-
#credit(amount, payment_method, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Latitude19Gateway
constructor
A new instance of Latitude19Gateway.
-
#purchase(amount, payment_method, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(payment_method, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#verify(payment_method, options = {}, action = nil) ⇒ 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
Returns a new instance of Latitude19Gateway.
54
55
56
57
|
# File 'lib/active_merchant/billing/gateways/latitude19.rb', line 54
def initialize(options = {})
requires!(options, :account_number, :configuration_id, :secret)
super
end
|
Instance Method Details
#authorize(amount, payment_method, options = {}) ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/active_merchant/billing/gateways/latitude19.rb', line 71
def authorize(amount, payment_method, options = {})
if payment_method.is_a?(String)
auth_or_sale('auth', payment_method, amount, nil, options)
else
MultiResponse.run() do |r|
r.process { get_session(options) }
r.process { get_token(r.authorization, payment_method, options) }
r.process { auth_or_sale('auth', r.authorization, amount, payment_method, options) }
end
end
end
|
#capture(amount, authorization, options = {}) ⇒ Object
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/active_merchant/billing/gateways/latitude19.rb', line 83
def capture(amount, authorization, options = {})
post = {}
post[:method] = 'deposit'
add_request_id(post)
params = {}
_, params[:pgwTID] = split_authorization(authorization)
add_invoice(params, amount, options)
add_credentials(params, post[:method])
post[:params] = [params]
commit('v1/', post)
end
|
#credit(amount, payment_method, options = {}) ⇒ Object
112
113
114
115
116
117
118
119
120
121
122
|
# File 'lib/active_merchant/billing/gateways/latitude19.rb', line 112
def credit(amount, payment_method, options = {})
if payment_method.is_a?(String)
refundWithCard(payment_method, amount, nil, options)
else
MultiResponse.run() do |r|
r.process { get_session(options) }
r.process { get_token(r.authorization, payment_method, options) }
r.process { refundWithCard(r.authorization, amount, payment_method, options) }
end
end
end
|
#purchase(amount, payment_method, options = {}) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/active_merchant/billing/gateways/latitude19.rb', line 59
def purchase(amount, payment_method, options = {})
if payment_method.is_a?(String)
auth_or_sale('sale', payment_method, amount, nil, options)
else
MultiResponse.run() do |r|
r.process { get_session(options) }
r.process { get_token(r.authorization, payment_method, options) }
r.process { auth_or_sale('sale', r.authorization, amount, payment_method, options) }
end
end
end
|
#scrub(transcript) ⇒ Object
144
145
146
147
148
|
# File 'lib/active_merchant/billing/gateways/latitude19.rb', line 144
def scrub(transcript)
transcript.
gsub(%r((\"cardNumber\\\":\\\")\d+), '\1[FILTERED]').
gsub(%r((\"cvv\\\":\\\")\d+), '\1[FILTERED]')
end
|
#store(payment_method, options = {}) ⇒ Object
136
137
138
|
# File 'lib/active_merchant/billing/gateways/latitude19.rb', line 136
def store(payment_method, options = {})
verify(payment_method, options, 'store')
end
|
#supports_scrubbing? ⇒ Boolean
140
141
142
|
# File 'lib/active_merchant/billing/gateways/latitude19.rb', line 140
def supports_scrubbing?
true
end
|
#verify(payment_method, options = {}, action = nil) ⇒ Object
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/active_merchant/billing/gateways/latitude19.rb', line 124
def verify(payment_method, options = {}, action = nil)
if payment_method.is_a?(String)
verifyOnly(action, payment_method, nil, options)
else
MultiResponse.run() do |r|
r.process { get_session(options) }
r.process { get_token(r.authorization, payment_method, options) }
r.process { verifyOnly(action, r.authorization, payment_method, options) }
end
end
end
|
#void(authorization, options = {}) ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/active_merchant/billing/gateways/latitude19.rb', line 99
def void(authorization, options = {})
method, pgwTID = split_authorization(authorization)
case method
when 'auth'
reverse_or_void('reversal', pgwTID, options)
when 'deposit', 'sale'
reverse_or_void('void', pgwTID, options)
else
message = 'Unsupported operation: successful Purchase, Authorize and unsettled Capture transactions can only be voided.'
return Response.new(false, message)
end
end
|