activemerchant 1.56.0 → 1.66.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +331 -0
- data/README.md +9 -9
- data/lib/active_merchant/billing/check.rb +3 -0
- data/lib/active_merchant/billing/credit_card.rb +8 -3
- data/lib/active_merchant/billing/credit_card_methods.rb +41 -1
- data/lib/active_merchant/billing/gateway.rb +14 -6
- data/lib/active_merchant/billing/gateways/adyen.rb +228 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +157 -44
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +7 -4
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +283 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +68 -2
- data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/blue_snap.rb +348 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +58 -20
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +37 -8
- data/lib/active_merchant/billing/gateways/card_stream.rb +161 -40
- data/lib/active_merchant/billing/gateways/cashnet.rb +1 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +5 -2
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +24 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +24 -40
- data/lib/active_merchant/billing/gateways/conekta.rb +6 -1
- data/lib/active_merchant/billing/gateways/creditcall.rb +1 -1
- data/lib/active_merchant/billing/gateways/credorax.rb +310 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +80 -64
- data/lib/active_merchant/billing/gateways/data_cash.rb +10 -304
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +40 -26
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +16 -2
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +6 -1
- data/lib/active_merchant/billing/gateways/forte.rb +10 -2
- data/lib/active_merchant/billing/gateways/global_collect.rb +311 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +1 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +13 -0
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +33 -19
- data/lib/active_merchant/billing/gateways/kushki.rb +217 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +416 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +2 -0
- data/lib/active_merchant/billing/gateways/litle.rb +29 -13
- data/lib/active_merchant/billing/gateways/mastercard.rb +268 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +145 -122
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +15 -1
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +10 -7
- data/lib/active_merchant/billing/gateways/mercury.rb +13 -5
- data/lib/active_merchant/billing/gateways/metrics_global.rb +1 -1
- data/lib/active_merchant/billing/gateways/migs.rb +23 -1
- data/lib/active_merchant/billing/gateways/monei.rb +1 -1
- data/lib/active_merchant/billing/gateways/moneris.rb +21 -1
- data/lib/active_merchant/billing/gateways/nab_transact.rb +12 -0
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/netbanx.rb +245 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +30 -9
- data/lib/active_merchant/billing/gateways/omise.rb +9 -5
- data/lib/active_merchant/billing/gateways/openpay.rb +10 -1
- data/lib/active_merchant/billing/gateways/opp.rb +362 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +28 -7
- data/lib/active_merchant/billing/gateways/pagarme.rb +248 -0
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +190 -0
- data/lib/active_merchant/billing/gateways/payeezy.rb +61 -12
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +6 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/paymill.rb +29 -11
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -6
- data/lib/active_merchant/billing/gateways/payu_in.rb +3 -2
- data/lib/active_merchant/billing/gateways/payu_latam.rb +402 -0
- data/lib/active_merchant/billing/gateways/pin.rb +6 -3
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +0 -2
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -1
- data/lib/active_merchant/billing/gateways/quickpay.rb +3 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +44 -1
- data/lib/active_merchant/billing/gateways/redsys.rb +3 -0
- data/lib/active_merchant/billing/gateways/s5.rb +8 -5
- data/lib/active_merchant/billing/gateways/safe_charge.rb +220 -0
- data/lib/active_merchant/billing/gateways/sage.rb +397 -128
- data/lib/active_merchant/billing/gateways/sage_pay.rb +45 -20
- data/lib/active_merchant/billing/gateways/secure_net.rb +0 -5
- data/lib/active_merchant/billing/gateways/secure_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +12 -0
- data/lib/active_merchant/billing/gateways/securion_pay.rb +46 -17
- data/lib/active_merchant/billing/gateways/stripe.rb +125 -29
- data/lib/active_merchant/billing/gateways/telr.rb +275 -0
- data/lib/active_merchant/billing/gateways/tns.rb +13 -222
- data/lib/active_merchant/billing/gateways/trans_first.rb +40 -16
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +606 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +114 -9
- data/lib/active_merchant/billing/gateways/vanco.rb +14 -10
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +209 -0
- data/lib/active_merchant/billing/gateways/wepay.rb +73 -38
- data/lib/active_merchant/billing/gateways/wirecard.rb +1 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +48 -16
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +15 -0
- data/lib/active_merchant/country.rb +6 -4
- data/lib/active_merchant/posts_data.rb +1 -1
- data/lib/active_merchant/version.rb +1 -1
- metadata +32 -13
- data/lib/active_merchant/billing/gateways/app55.rb +0 -176
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -89
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -115
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -97
@@ -0,0 +1,220 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class SafeChargeGateway < Gateway
|
6
|
+
self.test_url = 'https://process.sandbox.safecharge.com/service.asmx/Process'
|
7
|
+
self.live_url = 'https://process.safecharge.com/service.asmx/Process'
|
8
|
+
|
9
|
+
self.supported_countries = ['US']
|
10
|
+
self.default_currency = 'USD'
|
11
|
+
self.supported_cardtypes = [:visa, :master]
|
12
|
+
|
13
|
+
self.homepage_url = 'https://www.safecharge.com'
|
14
|
+
self.display_name = 'SafeCharge'
|
15
|
+
|
16
|
+
VERSION = '4.0.4'
|
17
|
+
|
18
|
+
def initialize(options={})
|
19
|
+
requires!(options, :client_login_id, :client_password)
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def purchase(money, payment, options={})
|
24
|
+
post = {}
|
25
|
+
add_transaction_data("Sale", post, money, options)
|
26
|
+
add_payment(post, payment)
|
27
|
+
|
28
|
+
commit(post)
|
29
|
+
end
|
30
|
+
|
31
|
+
def authorize(money, payment, options={})
|
32
|
+
post = {}
|
33
|
+
add_transaction_data("Auth", post, money, options)
|
34
|
+
add_payment(post, payment)
|
35
|
+
|
36
|
+
commit(post)
|
37
|
+
end
|
38
|
+
|
39
|
+
def capture(money, authorization, options={})
|
40
|
+
post = {}
|
41
|
+
add_transaction_data("Settle", post, money, options)
|
42
|
+
auth, transaction_id, token, exp_month, exp_year, _ = authorization.split("|")
|
43
|
+
post[:sg_AuthCode] = auth
|
44
|
+
post[:sg_TransactionID] = transaction_id
|
45
|
+
post[:sg_CCToken] = token
|
46
|
+
post[:sg_ExpMonth] = exp_month
|
47
|
+
post[:sg_ExpYear] = exp_year
|
48
|
+
|
49
|
+
commit(post)
|
50
|
+
end
|
51
|
+
|
52
|
+
def refund(money, authorization, options={})
|
53
|
+
post = {}
|
54
|
+
add_transaction_data("Credit", post, money, options)
|
55
|
+
auth, transaction_id, token, exp_month, exp_year, _ = authorization.split("|")
|
56
|
+
post[:sg_CreditType] = 2
|
57
|
+
post[:sg_AuthCode] = auth
|
58
|
+
post[:sg_TransactionID] = transaction_id
|
59
|
+
post[:sg_CCToken] = token
|
60
|
+
post[:sg_ExpMonth] = exp_month
|
61
|
+
post[:sg_ExpYear] = exp_year
|
62
|
+
|
63
|
+
commit(post)
|
64
|
+
end
|
65
|
+
|
66
|
+
def credit(money, payment, options={})
|
67
|
+
post = {}
|
68
|
+
add_payment(post, payment)
|
69
|
+
add_transaction_data("Credit", post, money, options)
|
70
|
+
post[:sg_CreditType] = 1
|
71
|
+
|
72
|
+
commit(post)
|
73
|
+
end
|
74
|
+
|
75
|
+
def void(authorization, options={})
|
76
|
+
post = {}
|
77
|
+
auth, transaction_id, token, exp_month, exp_year, original_amount = authorization.split("|")
|
78
|
+
add_transaction_data("Void", post, (original_amount.to_f * 100), options)
|
79
|
+
post[:sg_CreditType] = 2
|
80
|
+
post[:sg_AuthCode] = auth
|
81
|
+
post[:sg_TransactionID] = transaction_id
|
82
|
+
post[:sg_CCToken] = token
|
83
|
+
post[:sg_ExpMonth] = exp_month
|
84
|
+
post[:sg_ExpYear] = exp_year
|
85
|
+
|
86
|
+
commit(post)
|
87
|
+
end
|
88
|
+
|
89
|
+
def verify(credit_card, options={})
|
90
|
+
MultiResponse.run(:use_first_response) do |r|
|
91
|
+
r.process { authorize(100, credit_card, options) }
|
92
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def supports_scrubbing?
|
97
|
+
true
|
98
|
+
end
|
99
|
+
|
100
|
+
def scrub(transcript)
|
101
|
+
transcript.
|
102
|
+
gsub(%r((sg_ClientPassword=)[^&]+(&?)), '\1[FILTERED]\2').
|
103
|
+
gsub(%r((sg_CardNumber=)[^&]+(&?)), '\1[FILTERED]\2').
|
104
|
+
gsub(%r((sg_CVV2=)\d+), '\1[FILTERED]')
|
105
|
+
end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
def add_transaction_data(trans_type, post, money, options)
|
110
|
+
post[:sg_TransType] = trans_type
|
111
|
+
post[:sg_Currency] = (options[:currency] || currency(money))
|
112
|
+
post[:sg_Amount] = amount(money)
|
113
|
+
post[:sg_ClientLoginID] = @options[:client_login_id]
|
114
|
+
post[:sg_ClientPassword] = @options[:client_password]
|
115
|
+
post[:sg_ResponseFormat] = "4"
|
116
|
+
post[:sg_Version] = VERSION
|
117
|
+
end
|
118
|
+
|
119
|
+
def add_payment(post, payment)
|
120
|
+
post[:sg_NameOnCard] = payment.name
|
121
|
+
post[:sg_CardNumber] = payment.number
|
122
|
+
post[:sg_ExpMonth] = format(payment.month, :two_digits)
|
123
|
+
post[:sg_ExpYear] = format(payment.year, :two_digits)
|
124
|
+
post[:sg_CVV2] = payment.verification_value
|
125
|
+
end
|
126
|
+
|
127
|
+
def parse(xml)
|
128
|
+
response = {}
|
129
|
+
|
130
|
+
doc = Nokogiri::XML(xml)
|
131
|
+
doc.root.xpath('*').each do |node|
|
132
|
+
response[node.name.underscore.downcase.to_sym] = node.text
|
133
|
+
end
|
134
|
+
|
135
|
+
response
|
136
|
+
end
|
137
|
+
|
138
|
+
def childnode_to_response(response, node, childnode)
|
139
|
+
name = "#{node.name.downcase}_#{childnode.name.downcase}"
|
140
|
+
if name == 'payment_method_data' && !childnode.elements.empty?
|
141
|
+
response[name.to_sym] = Hash.from_xml(childnode.to_s).values.first
|
142
|
+
else
|
143
|
+
response[name.to_sym] = childnode.text
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def commit(parameters)
|
148
|
+
url = (test? ? test_url : live_url)
|
149
|
+
response = parse(ssl_post(url, post_data(parameters)))
|
150
|
+
|
151
|
+
Response.new(
|
152
|
+
success_from(response),
|
153
|
+
message_from(response),
|
154
|
+
response,
|
155
|
+
authorization: authorization_from(response, parameters),
|
156
|
+
avs_result: AVSResult.new(code: response[:avs_code]),
|
157
|
+
cvv_result: CVVResult.new(response[:cvv2_reply]),
|
158
|
+
test: test?,
|
159
|
+
error_code: error_code_from(response)
|
160
|
+
)
|
161
|
+
end
|
162
|
+
|
163
|
+
def success_from(response)
|
164
|
+
response[:status] == "APPROVED"
|
165
|
+
end
|
166
|
+
|
167
|
+
def message_from(response)
|
168
|
+
return "Success" if success_from(response)
|
169
|
+
response[:reason_codes] || response[:reason]
|
170
|
+
end
|
171
|
+
|
172
|
+
def authorization_from(response, parameters)
|
173
|
+
[
|
174
|
+
response[:auth_code],
|
175
|
+
response[:transaction_id],
|
176
|
+
response[:token],
|
177
|
+
parameters[:sg_ExpMonth],
|
178
|
+
parameters[:sg_ExpYear],
|
179
|
+
parameters[:sg_Amount]
|
180
|
+
].join("|")
|
181
|
+
end
|
182
|
+
|
183
|
+
def split_authorization(authorization)
|
184
|
+
auth_code, transaction_id, token, month, year, original_amount = authorization.split("|")
|
185
|
+
|
186
|
+
{
|
187
|
+
auth_code: auth_code,
|
188
|
+
transaction_id: transaction_id,
|
189
|
+
token: token,
|
190
|
+
exp_month: month,
|
191
|
+
exp_year: year,
|
192
|
+
original_amount: amount(original_amount.to_f * 100)
|
193
|
+
}
|
194
|
+
end
|
195
|
+
|
196
|
+
def post_data(params)
|
197
|
+
return nil unless params
|
198
|
+
|
199
|
+
params.map do |key, value|
|
200
|
+
next if value != false && value.blank?
|
201
|
+
"#{key}=#{CGI.escape(value.to_s)}"
|
202
|
+
end.compact.join("&")
|
203
|
+
end
|
204
|
+
|
205
|
+
def error_code_from(response)
|
206
|
+
unless success_from(response)
|
207
|
+
response[:ex_err_code] || response[:err_code]
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def underscore(camel_cased_word)
|
212
|
+
camel_cased_word.to_s.gsub(/::/, '/').
|
213
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
214
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
215
|
+
tr("-", "_").
|
216
|
+
downcase
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|