activemerchant 1.44.1 → 1.45.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -3
- data.tar.gz.sig +0 -0
- data/CHANGELOG +48 -0
- data/CONTRIBUTORS +12 -0
- data/README.md +15 -5
- data/lib/active_merchant/billing.rb +2 -0
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/gateway.rb +36 -4
- data/lib/active_merchant/billing/gateways/adyen.rb +6 -2
- data/lib/active_merchant/billing/gateways/authorize_net.rb +332 -255
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +9 -9
- data/lib/active_merchant/billing/gateways/borgun.rb +0 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +8 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +17 -10
- data/lib/active_merchant/billing/gateways/checkout.rb +213 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +1 -1
- data/lib/active_merchant/billing/gateways/cyber_source.rb +1 -1
- data/lib/active_merchant/billing/gateways/elavon.rb +3 -3
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +114 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +1 -1
- data/lib/active_merchant/billing/gateways/global_transport.rb +183 -0
- data/lib/active_merchant/billing/gateways/hps.rb +27 -20
- data/lib/active_merchant/billing/gateways/iats_payments.rb +68 -35
- data/lib/active_merchant/billing/gateways/litle.rb +36 -1
- data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +8 -4
- data/lib/active_merchant/billing/gateways/mercury.rb +17 -10
- data/lib/active_merchant/billing/gateways/moneris.rb +11 -6
- data/lib/active_merchant/billing/gateways/moneris_us.rb +126 -33
- data/lib/active_merchant/billing/gateways/money_movers.rb +0 -1
- data/lib/active_merchant/billing/gateways/net_registry.rb +6 -1
- data/lib/active_merchant/billing/gateways/network_merchants.rb +5 -5
- data/lib/active_merchant/billing/gateways/nmi.rb +241 -5
- data/lib/active_merchant/billing/gateways/openpay.rb +1 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +6 -1
- data/lib/active_merchant/billing/gateways/orbital.rb +6 -4
- data/lib/active_merchant/billing/gateways/pay_junction.rb +9 -5
- data/lib/active_merchant/billing/gateways/payex.rb +19 -9
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +0 -2
- data/lib/active_merchant/billing/gateways/pin.rb +1 -1
- data/lib/active_merchant/billing/gateways/psigate.rb +1 -2
- data/lib/active_merchant/billing/gateways/redsys.rb +37 -40
- data/lib/active_merchant/billing/gateways/secure_pay.rb +181 -9
- data/lib/active_merchant/billing/gateways/stripe.rb +106 -31
- data/lib/active_merchant/billing/gateways/tns.rb +227 -0
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +38 -10
- data/lib/active_merchant/billing/gateways/webpay.rb +14 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/response.rb +2 -1
- data/lib/active_merchant/country.rb +6 -1
- data/lib/active_merchant/version.rb +1 -1
- metadata +8 -3
- metadata.gz.sig +0 -0
- data/lib/active_merchant/billing/gateways/samurai.rb +0 -130
@@ -60,6 +60,20 @@ module ActiveMerchant #:nodoc:
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
def update(customer_id, creditcard, options = {})
|
64
|
+
post = {}
|
65
|
+
add_creditcard(post, creditcard, options)
|
66
|
+
commit(:post, "customers/#{CGI.escape(customer_id)}", post, options)
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def create_post_for_auth_or_purchase(money, creditcard, options)
|
72
|
+
stripe_post = super
|
73
|
+
stripe_post[:description] ||= stripe_post.delete(:metadata).try(:[], :email)
|
74
|
+
stripe_post
|
75
|
+
end
|
76
|
+
|
63
77
|
def json_error(raw_response)
|
64
78
|
msg = 'Invalid response received from the WebPay API. Please contact support@webpay.jp if you continue to receive this message.'
|
65
79
|
msg += " (The raw response returned by the API was #{raw_response.inspect})"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
# Base class representation of cryptographic payment data tokens that may be used for EMV-style transactions
|
4
|
+
# like Apple Pay. Payment data may be transmitted via any data type, and may also be padded
|
5
|
+
# with metadata specific to the cryptographer. This metadata should be parsed and interpreted in concrete
|
6
|
+
# implementations of your given cryptographer. Like credit cards, you must also return a string representing
|
7
|
+
# the token's type, like 'apple_pay' or 'stripe' should your target payment gateway process these tokens.
|
8
|
+
class PaymentToken
|
9
|
+
attr_reader :payment_data, :type
|
10
|
+
|
11
|
+
def initialize(payment_data, options = {})
|
12
|
+
@payment_data = payment_data
|
13
|
+
@metadata = options.with_indifferent_access
|
14
|
+
end
|
15
|
+
|
16
|
+
def type
|
17
|
+
raise NotImplementedError
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
|
|
4
4
|
end
|
5
5
|
|
6
6
|
class Response
|
7
|
-
attr_reader :params, :message, :test, :authorization, :avs_result, :cvv_result
|
7
|
+
attr_reader :params, :message, :test, :authorization, :avs_result, :cvv_result, :error_code
|
8
8
|
|
9
9
|
def success?
|
10
10
|
@success
|
@@ -23,6 +23,7 @@ module ActiveMerchant #:nodoc:
|
|
23
23
|
@test = options[:test] || false
|
24
24
|
@authorization = options[:authorization]
|
25
25
|
@fraud_review = options[:fraud_review]
|
26
|
+
@error_code = options[:error_code]
|
26
27
|
|
27
28
|
@avs_result = if options[:avs_result].kind_of?(AVSResult)
|
28
29
|
options[:avs_result].to_hash
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemerchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.45.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Luetke
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
fl3hbtVFTqbOlwL9vy1fudXcolIE/ZTcxQ+er07ZFZdKCXayR9PPs64heamfn0fp
|
31
31
|
TConQSX2BnZdhIEYW+cKzEC/bLc=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2014-
|
33
|
+
date: 2014-12-02 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: activesupport
|
@@ -214,6 +214,7 @@ files:
|
|
214
214
|
- README.md
|
215
215
|
- lib/active_merchant.rb
|
216
216
|
- lib/active_merchant/billing.rb
|
217
|
+
- lib/active_merchant/billing/apple_pay_payment_token.rb
|
217
218
|
- lib/active_merchant/billing/avs_result.rb
|
218
219
|
- lib/active_merchant/billing/base.rb
|
219
220
|
- lib/active_merchant/billing/check.rb
|
@@ -230,6 +231,7 @@ files:
|
|
230
231
|
- lib/active_merchant/billing/gateways/authorize_net_arb.rb
|
231
232
|
- lib/active_merchant/billing/gateways/authorize_net_cim.rb
|
232
233
|
- lib/active_merchant/billing/gateways/balanced.rb
|
234
|
+
- lib/active_merchant/billing/gateways/bank_frick.rb
|
233
235
|
- lib/active_merchant/billing/gateways/banwire.rb
|
234
236
|
- lib/active_merchant/billing/gateways/barclays_epdq.rb
|
235
237
|
- lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb
|
@@ -251,6 +253,7 @@ files:
|
|
251
253
|
- lib/active_merchant/billing/gateways/cc5.rb
|
252
254
|
- lib/active_merchant/billing/gateways/cecabank.rb
|
253
255
|
- lib/active_merchant/billing/gateways/certo_direct.rb
|
256
|
+
- lib/active_merchant/billing/gateways/checkout.rb
|
254
257
|
- lib/active_merchant/billing/gateways/commercegate.rb
|
255
258
|
- lib/active_merchant/billing/gateways/conekta.rb
|
256
259
|
- lib/active_merchant/billing/gateways/cyber_source.rb
|
@@ -270,6 +273,7 @@ files:
|
|
270
273
|
- lib/active_merchant/billing/gateways/first_pay.rb
|
271
274
|
- lib/active_merchant/billing/gateways/firstdata_e4.rb
|
272
275
|
- lib/active_merchant/billing/gateways/garanti.rb
|
276
|
+
- lib/active_merchant/billing/gateways/global_transport.rb
|
273
277
|
- lib/active_merchant/billing/gateways/hdfc.rb
|
274
278
|
- lib/active_merchant/billing/gateways/hps.rb
|
275
279
|
- lib/active_merchant/billing/gateways/iats_payments.rb
|
@@ -354,7 +358,6 @@ files:
|
|
354
358
|
- lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb
|
355
359
|
- lib/active_merchant/billing/gateways/sage_pay.rb
|
356
360
|
- lib/active_merchant/billing/gateways/sallie_mae.rb
|
357
|
-
- lib/active_merchant/billing/gateways/samurai.rb
|
358
361
|
- lib/active_merchant/billing/gateways/secure_net.rb
|
359
362
|
- lib/active_merchant/billing/gateways/secure_pay.rb
|
360
363
|
- lib/active_merchant/billing/gateways/secure_pay_au.rb
|
@@ -365,6 +368,7 @@ files:
|
|
365
368
|
- lib/active_merchant/billing/gateways/spreedly_core.rb
|
366
369
|
- lib/active_merchant/billing/gateways/stripe.rb
|
367
370
|
- lib/active_merchant/billing/gateways/swipe_checkout.rb
|
371
|
+
- lib/active_merchant/billing/gateways/tns.rb
|
368
372
|
- lib/active_merchant/billing/gateways/trans_first.rb
|
369
373
|
- lib/active_merchant/billing/gateways/transax.rb
|
370
374
|
- lib/active_merchant/billing/gateways/transnational.rb
|
@@ -381,6 +385,7 @@ files:
|
|
381
385
|
- lib/active_merchant/billing/gateways/worldpay.rb
|
382
386
|
- lib/active_merchant/billing/gateways/worldpay_us.rb
|
383
387
|
- lib/active_merchant/billing/model.rb
|
388
|
+
- lib/active_merchant/billing/payment_token.rb
|
384
389
|
- lib/active_merchant/billing/rails.rb
|
385
390
|
- lib/active_merchant/billing/response.rb
|
386
391
|
- lib/active_merchant/country.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,130 +0,0 @@
|
|
1
|
-
module ActiveMerchant #:nodoc:
|
2
|
-
module Billing #:nodoc:
|
3
|
-
class SamuraiGateway < Gateway
|
4
|
-
|
5
|
-
self.homepage_url = 'https://samurai.feefighters.com'
|
6
|
-
self.display_name = 'Samurai'
|
7
|
-
self.supported_countries = ['US']
|
8
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club]
|
9
|
-
self.default_currency = 'USD'
|
10
|
-
self.money_format = :dollars
|
11
|
-
|
12
|
-
def initialize(options = {})
|
13
|
-
begin
|
14
|
-
require 'samurai'
|
15
|
-
rescue LoadError
|
16
|
-
raise "Could not load the samurai gem (>= 0.2.25). Use `gem install samurai` to install it."
|
17
|
-
end
|
18
|
-
|
19
|
-
requires!(options, :login, :password, :processor_token)
|
20
|
-
Samurai.options = {
|
21
|
-
:merchant_key => options[:login],
|
22
|
-
:merchant_password => options[:password],
|
23
|
-
:processor_token => options[:processor_token]
|
24
|
-
}
|
25
|
-
|
26
|
-
super
|
27
|
-
end
|
28
|
-
|
29
|
-
def authorize(money, credit_card_or_vault_id, options = {})
|
30
|
-
token = payment_method_token(credit_card_or_vault_id, options)
|
31
|
-
return token if token.is_a?(Response)
|
32
|
-
|
33
|
-
authorize = Samurai::Processor.authorize(token, amount(money), processor_options(options))
|
34
|
-
handle_result(authorize)
|
35
|
-
rescue ActiveResource::ServerError => e
|
36
|
-
Response.new(false, e.message, {}, test: test?)
|
37
|
-
end
|
38
|
-
|
39
|
-
def purchase(money, credit_card_or_vault_id, options = {})
|
40
|
-
token = payment_method_token(credit_card_or_vault_id, options)
|
41
|
-
return token if token.is_a?(Response)
|
42
|
-
|
43
|
-
purchase = Samurai::Processor.purchase(token, amount(money), processor_options(options))
|
44
|
-
handle_result(purchase)
|
45
|
-
rescue ActiveResource::ServerError => e
|
46
|
-
Response.new(false, e.message, {}, test: test?)
|
47
|
-
end
|
48
|
-
|
49
|
-
def capture(money, authorization_id, options = {})
|
50
|
-
transaction = Samurai::Transaction.find(authorization_id)
|
51
|
-
handle_result(transaction.capture(amount(money)))
|
52
|
-
rescue ActiveResource::ServerError => e
|
53
|
-
Response.new(false, e.message, {}, test: test?)
|
54
|
-
end
|
55
|
-
|
56
|
-
def refund(money, transaction_id, options = {})
|
57
|
-
transaction = Samurai::Transaction.find(transaction_id)
|
58
|
-
handle_result(transaction.credit(amount(money)))
|
59
|
-
rescue ActiveResource::ServerError => e
|
60
|
-
Response.new(false, e.message, {}, test: test?)
|
61
|
-
end
|
62
|
-
|
63
|
-
def void(transaction_id, options = {})
|
64
|
-
transaction = Samurai::Transaction.find(transaction_id)
|
65
|
-
handle_result(transaction.void)
|
66
|
-
rescue ActiveResource::ServerError => e
|
67
|
-
Response.new(false, e.message, {}, test: test?)
|
68
|
-
end
|
69
|
-
|
70
|
-
def store(creditcard, options = {})
|
71
|
-
address = options[:billing_address] || options[:address] || {}
|
72
|
-
|
73
|
-
result = Samurai::PaymentMethod.create({
|
74
|
-
:card_number => creditcard.number,
|
75
|
-
:expiry_month => creditcard.month.to_s.rjust(2, "0"),
|
76
|
-
:expiry_year => creditcard.year.to_s,
|
77
|
-
:cvv => creditcard.verification_value,
|
78
|
-
:first_name => creditcard.first_name,
|
79
|
-
:last_name => creditcard.last_name,
|
80
|
-
:address_1 => address[:address1],
|
81
|
-
:address_2 => address[:address2],
|
82
|
-
:city => address[:city],
|
83
|
-
:zip => address[:zip],
|
84
|
-
:sandbox => test?
|
85
|
-
})
|
86
|
-
result.retain if options[:retain] && result.is_sensitive_data_valid && result.payment_method_token
|
87
|
-
|
88
|
-
Response.new(result.is_sensitive_data_valid,
|
89
|
-
message_from_result(result),
|
90
|
-
{ :payment_method_token => result.is_sensitive_data_valid && result.payment_method_token })
|
91
|
-
rescue ActiveResource::ServerError => e
|
92
|
-
Response.new(false, e.message, {}, test: test?)
|
93
|
-
end
|
94
|
-
|
95
|
-
private
|
96
|
-
|
97
|
-
def payment_method_token(credit_card_or_vault_id, options)
|
98
|
-
return credit_card_or_vault_id if credit_card_or_vault_id.is_a?(String)
|
99
|
-
store_result = store(credit_card_or_vault_id, options)
|
100
|
-
store_result.success? ? store_result.params["payment_method_token"] : store_result
|
101
|
-
end
|
102
|
-
|
103
|
-
def handle_result(result)
|
104
|
-
response_params, response_options = {}, {}
|
105
|
-
if result.success?
|
106
|
-
response_options[:test] = test?
|
107
|
-
response_options[:authorization] = result.reference_id
|
108
|
-
response_params[:reference_id] = result.reference_id
|
109
|
-
response_params[:transaction_token] = result.transaction_token
|
110
|
-
response_params[:payment_method_token] = result.payment_method.payment_method_token
|
111
|
-
end
|
112
|
-
|
113
|
-
response_options[:avs_result] = { :code => result.processor_response && result.processor_response.avs_result_code }
|
114
|
-
response_options[:cvv_result] = result.processor_response && result.processor_response.cvv_result_code
|
115
|
-
|
116
|
-
message = message_from_result(result)
|
117
|
-
Response.new(result.success?, message, response_params, response_options)
|
118
|
-
end
|
119
|
-
|
120
|
-
def message_from_result(result)
|
121
|
-
return "OK" if result.success?
|
122
|
-
result.errors.map {|_, messages| messages }.join(" ")
|
123
|
-
end
|
124
|
-
|
125
|
-
def processor_options(options)
|
126
|
-
options.slice(:billing_reference, :customer_reference, :custom, :descriptor)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|