activemerchant 1.20.3 → 1.20.4
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +4 -0
- data/lib/active_merchant.rb +16 -1
- data/lib/active_merchant/billing/gateways/efsnet.rb +9 -9
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +3 -3
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express.rb +40 -29
- data/lib/active_merchant/billing/gateways/stripe.rb +1 -1
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +4 -4
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +2 -2
- data/lib/active_merchant/version.rb +1 -1
- metadata +32 -21
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
data/lib/active_merchant.rb
CHANGED
@@ -30,7 +30,22 @@ require 'active_support/core_ext/class/attribute'
|
|
30
30
|
require 'active_support/core_ext/class/attribute_accessors'
|
31
31
|
require 'active_support/core_ext/class/delegating_attributes'
|
32
32
|
require 'active_support/core_ext/module/attribute_accessors'
|
33
|
-
|
33
|
+
|
34
|
+
begin
|
35
|
+
require 'active_support/base64'
|
36
|
+
|
37
|
+
unless defined?(Base64)
|
38
|
+
Base64 = ActiveSupport::Base64
|
39
|
+
end
|
40
|
+
|
41
|
+
unless Base64.respond_to?(:strict_encode64)
|
42
|
+
def Base64.strict_encode64(v)
|
43
|
+
ActiveSupport::Base64.encode64s(v)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
rescue LoadError
|
47
|
+
require 'base64'
|
48
|
+
end
|
34
49
|
|
35
50
|
require 'securerandom'
|
36
51
|
require 'builder'
|
@@ -60,7 +60,7 @@ module ActiveMerchant #:nodoc:
|
|
60
60
|
def void(identification, options = {})
|
61
61
|
requires!(options, :order_id)
|
62
62
|
original_transaction_id, original_transaction_amount = identification.split(";")
|
63
|
-
commit(:void_transaction, {:reference_number => format_reference_number(options[:order_id]), :
|
63
|
+
commit(:void_transaction, {:reference_number => format_reference_number(options[:order_id]), :transaction_id => original_transaction_id})
|
64
64
|
end
|
65
65
|
|
66
66
|
def voice_authorize(money, authorization_code, creditcard, options = {})
|
@@ -90,7 +90,7 @@ module ActiveMerchant #:nodoc:
|
|
90
90
|
:reference_number => format_reference_number(options[:order_id]),
|
91
91
|
:transaction_amount => amount(money),
|
92
92
|
:original_transaction_amount => original_transaction_amount,
|
93
|
-
:
|
93
|
+
:original_transaction_id => original_transaction_id,
|
94
94
|
:client_ip_address => options[:ip]
|
95
95
|
}
|
96
96
|
end
|
@@ -191,7 +191,7 @@ module ActiveMerchant #:nodoc:
|
|
191
191
|
transaction = root.add_element(action.to_s.camelize)
|
192
192
|
|
193
193
|
actions[action].each do |key|
|
194
|
-
transaction.add_element(key
|
194
|
+
transaction.add_element(key).text = parameters[key.underscore.to_sym] unless parameters[key.underscore.to_sym].blank?
|
195
195
|
end
|
196
196
|
|
197
197
|
xml.to_s
|
@@ -217,18 +217,18 @@ module ActiveMerchant #:nodoc:
|
|
217
217
|
ACTIONS
|
218
218
|
end
|
219
219
|
|
220
|
-
CREDIT_CARD_FIELDS =
|
220
|
+
CREDIT_CARD_FIELDS = %w(AuthorizationNumber ClientIpAddress BillingAddress BillingCity BillingState BillingPostalCode BillingCountry BillingName CardVerificationValue ExpirationMonth ExpirationYear ReferenceNumber TransactionAmount AccountNumber )
|
221
221
|
|
222
222
|
ACTIONS = {
|
223
223
|
:credit_card_authorize => CREDIT_CARD_FIELDS,
|
224
224
|
:credit_card_charge => CREDIT_CARD_FIELDS,
|
225
225
|
:credit_card_voice_authorize => CREDIT_CARD_FIELDS,
|
226
226
|
:credit_card_capture => CREDIT_CARD_FIELDS,
|
227
|
-
:credit_card_credit => CREDIT_CARD_FIELDS
|
228
|
-
:credit_card_refund =>
|
229
|
-
:void_transaction =>
|
230
|
-
:credit_card_settle =>
|
231
|
-
:system_check =>
|
227
|
+
:credit_card_credit => CREDIT_CARD_FIELDS + ["OriginalTransactionAmount"],
|
228
|
+
:credit_card_refund => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
|
229
|
+
:void_transaction => %w(ReferenceNumber TransactionID),
|
230
|
+
:credit_card_settle => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
|
231
|
+
:system_check => %w(SystemCheck),
|
232
232
|
}
|
233
233
|
end
|
234
234
|
end
|
@@ -219,7 +219,7 @@ module ActiveMerchant #:nodoc:
|
|
219
219
|
cert_data = OpenSSL::X509::Certificate.new(cert_file).to_s
|
220
220
|
cert_data = cert_data.sub(/-----BEGIN CERTIFICATE-----/, '')
|
221
221
|
cert_data = cert_data.sub(/-----END CERTIFICATE-----/, '')
|
222
|
-
fingerprint =
|
222
|
+
fingerprint = Base64.decode64(cert_data)
|
223
223
|
fingerprint = Digest::SHA1.hexdigest(fingerprint)
|
224
224
|
return fingerprint.upcase
|
225
225
|
end
|
@@ -227,12 +227,12 @@ module ActiveMerchant #:nodoc:
|
|
227
227
|
def sign_message(private_key_data, password, data)
|
228
228
|
private_key = OpenSSL::PKey::RSA.new(private_key_data, password)
|
229
229
|
signature = private_key.sign(OpenSSL::Digest::SHA1.new, data.gsub('\s', ''))
|
230
|
-
return
|
230
|
+
return Base64.encode64(signature).gsub(/\n/, '')
|
231
231
|
end
|
232
232
|
|
233
233
|
def verify_message(cert_file, data, signature)
|
234
234
|
public_key = OpenSSL::X509::Certificate.new(cert_file).public_key
|
235
|
-
return public_key.verify(OpenSSL::Digest::SHA1.new,
|
235
|
+
return public_key.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(signature), data)
|
236
236
|
end
|
237
237
|
|
238
238
|
def status_response_verified?(response)
|
@@ -313,8 +313,8 @@ module ActiveMerchant #:nodoc:
|
|
313
313
|
xml.tag! 'n2:CityName', address[:city]
|
314
314
|
xml.tag! 'n2:StateOrProvince', address[:state].blank? ? 'N/A' : address[:state]
|
315
315
|
xml.tag! 'n2:Country', address[:country]
|
316
|
-
xml.tag! 'n2:PostalCode', address[:zip]
|
317
316
|
xml.tag! 'n2:Phone', address[:phone]
|
317
|
+
xml.tag! 'n2:PostalCode', address[:zip]
|
318
318
|
end
|
319
319
|
end
|
320
320
|
|
@@ -98,12 +98,39 @@ module ActiveMerchant #:nodoc:
|
|
98
98
|
xml.tag! 'SetExpressCheckoutRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
99
99
|
xml.tag! 'n2:Version', API_VERSION
|
100
100
|
xml.tag! 'n2:SetExpressCheckoutRequestDetails' do
|
101
|
+
xml.tag! 'n2:ReturnURL', options[:return_url]
|
102
|
+
xml.tag! 'n2:CancelURL', options[:cancel_return_url]
|
101
103
|
if options[:max_amount]
|
102
104
|
xml.tag! 'n2:MaxAmount', localized_amount(options[:max_amount], currency_code), 'currencyID' => currency_code
|
103
105
|
end
|
106
|
+
xml.tag! 'n2:NoShipping', options[:no_shipping] ? '1' : '0'
|
107
|
+
xml.tag! 'n2:AddressOverride', options[:address_override] ? '1' : '0'
|
108
|
+
xml.tag! 'n2:LocaleCode', options[:locale] unless options[:locale].blank?
|
109
|
+
# Customization of the payment page
|
110
|
+
xml.tag! 'n2:PageStyle', options[:page_style] unless options[:page_style].blank?
|
111
|
+
xml.tag! 'n2:cpp-header-image', options[:header_image] unless options[:header_image].blank?
|
112
|
+
xml.tag! 'n2:cpp-header-border-color', options[:header_border_color] unless options[:header_border_color].blank?
|
113
|
+
xml.tag! 'n2:cpp-header-back-color', options[:header_background_color] unless options[:header_background_color].blank?
|
114
|
+
xml.tag! 'n2:cpp-payflow-color', options[:background_color] unless options[:background_color].blank?
|
115
|
+
if options[:allow_guest_checkout]
|
116
|
+
xml.tag! 'n2:SolutionType', 'Sole'
|
117
|
+
xml.tag! 'n2:LandingPage', 'Billing'
|
118
|
+
end
|
119
|
+
xml.tag! 'n2:BuyerEmail', options[:email] unless options[:email].blank?
|
120
|
+
|
121
|
+
if options[:billing_agreement]
|
122
|
+
xml.tag! 'n2:BillingAgreementDetails' do
|
123
|
+
xml.tag! 'n2:BillingType', options[:billing_agreement][:type]
|
124
|
+
xml.tag! 'n2:BillingAgreementDescription', options[:billing_agreement][:description]
|
125
|
+
xml.tag! 'n2:PaymentType', options[:billing_agreement][:payment_type] || 'InstantOnly'
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
104
129
|
if !options[:allow_note].nil?
|
105
130
|
xml.tag! 'n2:AllowNote', options[:allow_note] ? '1' : '0'
|
106
131
|
end
|
132
|
+
xml.tag! 'n2:CallbackURL', options[:callback_url] unless options[:callback_url].blank?
|
133
|
+
|
107
134
|
xml.tag! 'n2:PaymentDetails' do
|
108
135
|
xml.tag! 'n2:OrderTotal', amount(money).to_f.zero? ? localized_amount(100, currency_code) : localized_amount(money, currency_code), 'currencyID' => currency_code
|
109
136
|
# All of the values must be included together and add up to the order total
|
@@ -117,41 +144,25 @@ module ActiveMerchant #:nodoc:
|
|
117
144
|
xml.tag! 'n2:OrderDescription', options[:description]
|
118
145
|
xml.tag! 'n2:InvoiceID', options[:order_id]
|
119
146
|
|
120
|
-
add_items_xml(xml, options, currency_code) if options[:items]
|
121
|
-
|
122
147
|
add_address(xml, 'n2:ShipToAddress', options[:shipping_address] || options[:address])
|
123
148
|
|
149
|
+
add_items_xml(xml, options, currency_code) if options[:items]
|
150
|
+
|
124
151
|
xml.tag! 'n2:PaymentAction', action
|
125
152
|
end
|
126
153
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
if options[:billing_agreement]
|
135
|
-
xml.tag! 'n2:BillingAgreementDetails' do
|
136
|
-
xml.tag! 'n2:BillingType', options[:billing_agreement][:type]
|
137
|
-
xml.tag! 'n2:BillingAgreementDescription', options[:billing_agreement][:description]
|
138
|
-
xml.tag! 'n2:PaymentType', options[:billing_agreement][:payment_type] || 'InstantOnly'
|
154
|
+
if options[:shipping_options]
|
155
|
+
options[:shipping_options].each do |shipping_option|
|
156
|
+
xml.tag! 'n2:FlatRateShippingOptions' do
|
157
|
+
xml.tag! 'n2:ShippingOptionIsDefault', shipping_option[:default]
|
158
|
+
xml.tag! 'n2:ShippingOptionAmount', localized_amount(shipping_option[:amount], currency_code), 'currencyID' => currency_code
|
159
|
+
xml.tag! 'n2:ShippingOptionName', shipping_option[:name]
|
160
|
+
end
|
139
161
|
end
|
140
162
|
end
|
141
|
-
|
142
|
-
|
143
|
-
xml.tag! 'n2:
|
144
|
-
xml.tag! 'n2:cpp-header-image', options[:header_image] unless options[:header_image].blank?
|
145
|
-
xml.tag! 'n2:cpp-header-back-color', options[:header_background_color] unless options[:header_background_color].blank?
|
146
|
-
xml.tag! 'n2:cpp-header-border-color', options[:header_border_color] unless options[:header_border_color].blank?
|
147
|
-
xml.tag! 'n2:cpp-payflow-color', options[:background_color] unless options[:background_color].blank?
|
148
|
-
|
149
|
-
if options[:allow_guest_checkout]
|
150
|
-
xml.tag! 'n2:SolutionType', 'Sole'
|
151
|
-
xml.tag! 'n2:LandingPage', 'Billing'
|
152
|
-
end
|
153
|
-
|
154
|
-
xml.tag! 'n2:LocaleCode', options[:locale] unless options[:locale].blank?
|
163
|
+
|
164
|
+
xml.tag! 'n2:CallbackTimeout', options[:callback_timeout] unless options[:callback_timeout].blank?
|
165
|
+
xml.tag! 'n2:CallbackVersion', options[:callback_version] unless options[:callback_version].blank?
|
155
166
|
end
|
156
167
|
end
|
157
168
|
end
|
@@ -181,4 +192,4 @@ module ActiveMerchant #:nodoc:
|
|
181
192
|
end
|
182
193
|
end
|
183
194
|
end
|
184
|
-
end
|
195
|
+
end
|
@@ -177,7 +177,7 @@ module ActiveMerchant #:nodoc:
|
|
177
177
|
})
|
178
178
|
|
179
179
|
{
|
180
|
-
"Authorization" => "Basic " +
|
180
|
+
"Authorization" => "Basic " + Base64.encode64(@api_key.to_s + ":").strip,
|
181
181
|
"User-Agent" => "Stripe/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
182
182
|
"X-Stripe-Client-User-Agent" => @@ua
|
183
183
|
}
|
@@ -173,15 +173,15 @@ module ActiveMerchant #:nodoc:
|
|
173
173
|
end
|
174
174
|
|
175
175
|
def encode_value(value)
|
176
|
-
encoded =
|
176
|
+
encoded = Base64.strict_encode64(value)
|
177
177
|
string_to_encode = encoded[0, 1] + "T" + encoded[1, encoded.length]
|
178
|
-
|
178
|
+
Base64.strict_encode64(string_to_encode)
|
179
179
|
end
|
180
180
|
|
181
181
|
def decode_value(value)
|
182
|
-
decoded =
|
182
|
+
decoded = Base64.decode64(value)
|
183
183
|
string_to_decode = decoded[0, 1] + decoded[2, decoded.length]
|
184
|
-
|
184
|
+
Base64.decode64(string_to_decode)
|
185
185
|
end
|
186
186
|
|
187
187
|
def phone_code_for_country(country)
|
@@ -4,11 +4,11 @@ module ActiveMerchant #:nodoc:
|
|
4
4
|
module SagePayForm
|
5
5
|
module Encryption
|
6
6
|
def sage_encrypt(plaintext, key)
|
7
|
-
|
7
|
+
Base64.strict_encode64(sage_encrypt_xor(plaintext, key))
|
8
8
|
end
|
9
9
|
|
10
10
|
def sage_decrypt(ciphertext, key)
|
11
|
-
sage_encrypt_xor(
|
11
|
+
sage_encrypt_xor(Base64.decode64(ciphertext), key)
|
12
12
|
end
|
13
13
|
|
14
14
|
def sage_encrypt_salt(min, max)
|
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.20.
|
4
|
+
version: 1.20.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -50,11 +50,11 @@ cert_chain:
|
|
50
50
|
-----END CERTIFICATE-----
|
51
51
|
|
52
52
|
'
|
53
|
-
date: 2012-02-
|
53
|
+
date: 2012-02-22 00:00:00.000000000 Z
|
54
54
|
dependencies:
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activesupport
|
57
|
-
requirement: &
|
57
|
+
requirement: &2160908620 !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
60
60
|
- - ! '>='
|
@@ -62,10 +62,10 @@ dependencies:
|
|
62
62
|
version: 2.3.11
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
|
-
version_requirements: *
|
65
|
+
version_requirements: *2160908620
|
66
66
|
- !ruby/object:Gem::Dependency
|
67
67
|
name: i18n
|
68
|
-
requirement: &
|
68
|
+
requirement: &2160906200 !ruby/object:Gem::Requirement
|
69
69
|
none: false
|
70
70
|
requirements:
|
71
71
|
- - ! '>='
|
@@ -73,10 +73,10 @@ dependencies:
|
|
73
73
|
version: '0'
|
74
74
|
type: :runtime
|
75
75
|
prerelease: false
|
76
|
-
version_requirements: *
|
76
|
+
version_requirements: *2160906200
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
78
|
name: money
|
79
|
-
requirement: &
|
79
|
+
requirement: &2160903920 !ruby/object:Gem::Requirement
|
80
80
|
none: false
|
81
81
|
requirements:
|
82
82
|
- - <=
|
@@ -84,10 +84,10 @@ dependencies:
|
|
84
84
|
version: 3.7.1
|
85
85
|
type: :runtime
|
86
86
|
prerelease: false
|
87
|
-
version_requirements: *
|
87
|
+
version_requirements: *2160903920
|
88
88
|
- !ruby/object:Gem::Dependency
|
89
89
|
name: builder
|
90
|
-
requirement: &
|
90
|
+
requirement: &2160903260 !ruby/object:Gem::Requirement
|
91
91
|
none: false
|
92
92
|
requirements:
|
93
93
|
- - ! '>='
|
@@ -95,10 +95,10 @@ dependencies:
|
|
95
95
|
version: 2.0.0
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
|
-
version_requirements: *
|
98
|
+
version_requirements: *2160903260
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: braintree
|
101
|
-
requirement: &
|
101
|
+
requirement: &2160902360 !ruby/object:Gem::Requirement
|
102
102
|
none: false
|
103
103
|
requirements:
|
104
104
|
- - ! '>='
|
@@ -106,10 +106,21 @@ dependencies:
|
|
106
106
|
version: 2.0.0
|
107
107
|
type: :runtime
|
108
108
|
prerelease: false
|
109
|
-
version_requirements: *
|
109
|
+
version_requirements: *2160902360
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: json
|
112
|
+
requirement: &2160901520 !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.5.1
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: *2160901520
|
110
121
|
- !ruby/object:Gem::Dependency
|
111
122
|
name: active_utils
|
112
|
-
requirement: &
|
123
|
+
requirement: &2160900860 !ruby/object:Gem::Requirement
|
113
124
|
none: false
|
114
125
|
requirements:
|
115
126
|
- - ! '>='
|
@@ -117,10 +128,10 @@ dependencies:
|
|
117
128
|
version: 1.0.2
|
118
129
|
type: :runtime
|
119
130
|
prerelease: false
|
120
|
-
version_requirements: *
|
131
|
+
version_requirements: *2160900860
|
121
132
|
- !ruby/object:Gem::Dependency
|
122
133
|
name: rake
|
123
|
-
requirement: &
|
134
|
+
requirement: &2160900340 !ruby/object:Gem::Requirement
|
124
135
|
none: false
|
125
136
|
requirements:
|
126
137
|
- - ! '>='
|
@@ -128,10 +139,10 @@ dependencies:
|
|
128
139
|
version: '0'
|
129
140
|
type: :development
|
130
141
|
prerelease: false
|
131
|
-
version_requirements: *
|
142
|
+
version_requirements: *2160900340
|
132
143
|
- !ruby/object:Gem::Dependency
|
133
144
|
name: mocha
|
134
|
-
requirement: &
|
145
|
+
requirement: &2160899500 !ruby/object:Gem::Requirement
|
135
146
|
none: false
|
136
147
|
requirements:
|
137
148
|
- - ! '>='
|
@@ -139,10 +150,10 @@ dependencies:
|
|
139
150
|
version: '0'
|
140
151
|
type: :development
|
141
152
|
prerelease: false
|
142
|
-
version_requirements: *
|
153
|
+
version_requirements: *2160899500
|
143
154
|
- !ruby/object:Gem::Dependency
|
144
155
|
name: rails
|
145
|
-
requirement: &
|
156
|
+
requirement: &2160898320 !ruby/object:Gem::Requirement
|
146
157
|
none: false
|
147
158
|
requirements:
|
148
159
|
- - ! '>='
|
@@ -150,7 +161,7 @@ dependencies:
|
|
150
161
|
version: 2.3.11
|
151
162
|
type: :development
|
152
163
|
prerelease: false
|
153
|
-
version_requirements: *
|
164
|
+
version_requirements: *2160898320
|
154
165
|
description: Active Merchant is a simple payment abstraction library used in and sponsored
|
155
166
|
by Shopify. It is written by Tobias Luetke, Cody Fauser, and contributors. The aim
|
156
167
|
of the project is to feel natural to Ruby users and to abstract as many parts as
|
@@ -370,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
370
381
|
version: '0'
|
371
382
|
requirements: []
|
372
383
|
rubyforge_project: activemerchant
|
373
|
-
rubygems_version: 1.8.
|
384
|
+
rubygems_version: 1.8.16
|
374
385
|
signing_key:
|
375
386
|
specification_version: 3
|
376
387
|
summary: Framework and tools for dealing with credit card transactions.
|
metadata.gz.sig
CHANGED
Binary file
|