activemerchant 1.17.0 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,15 @@
1
1
  = ActiveMerchant CHANGELOG
2
2
 
3
+ == Version 1.18.0 (September 23, 2011)
4
+
5
+ * NoChex: Update the URL that payment requests are posted to [caseywhalen/jduff]
6
+ * QBMS: fixed test mode check [Soleone]
7
+ * Realex: encode avs info with shipping address [Soleone]
8
+ * Add Dwolla offsite gateway [armsteadj1/jduff]
9
+ * Eway: pass email, customer, description and options to store [moklett/tobi]
10
+ * New dependency: active_utils gem [odorcicd]
11
+ * Optimal Payments: fix test mode check [jduff]
12
+
3
13
  == Version 1.17.0 (August 23, 2011)
4
14
 
5
15
  * Add Payflow Link integration [jduff]
data/CONTRIBUTORS CHANGED
@@ -248,6 +248,10 @@ Optimal Payments (August, 2011)
248
248
 
249
249
  * Jamie Macey (jamie)
250
250
 
251
- CardSave (August 2011,)
251
+ CardSave (August, 2011)
252
252
 
253
253
  * Tom Crinson (MrJaba)
254
+
255
+ Dwolla (September, 2011)
256
+
257
+ * James Armstead (armsteadj1)
@@ -36,7 +36,7 @@ require 'builder'
36
36
  require 'cgi'
37
37
  require 'rexml/document'
38
38
 
39
- require 'active_merchant/common'
39
+ require 'active_utils'
40
40
  require 'active_merchant/billing'
41
41
  require 'active_merchant/version'
42
42
 
@@ -180,15 +180,21 @@ module ActiveMerchant #:nodoc:
180
180
  end
181
181
 
182
182
  def do_authorize(params)
183
- headers = {
184
- 'Referer' => options[:password]
185
- }
183
+ headers = {}
184
+ headers['Referer'] = options[:password] if options[:password]
186
185
 
187
186
  response = raw_ssl_request(:post, 'https://' + API_HOST + '/auth/default.aspx', authorize_post_data(params), headers)
188
187
 
189
188
  # Authorize gives the response back by redirecting with the values in
190
189
  # the URL query
191
- query = CGI::parse(URI.parse(response['Location'].gsub(' ', '%20')).query)
190
+ if location = response['Location']
191
+ query = CGI::parse(URI.parse(location.gsub(' ', '%20')).query)
192
+ else
193
+ return {
194
+ 'accept' => '0',
195
+ 'errortext' => 'No Location header returned.'
196
+ }
197
+ end
192
198
 
193
199
  result = {}
194
200
  query.each_pair do |k,v|
@@ -45,7 +45,7 @@ module ActiveMerchant #:nodoc:
45
45
 
46
46
  add_creditcard(post, creditcard)
47
47
  add_address(post, billing_address)
48
- add_misc_fields(post, billing_address)
48
+ add_misc_fields(post, options)
49
49
 
50
50
  commit("CreateCustomer", post)
51
51
  end
@@ -63,17 +63,30 @@ module ActiveMerchant #:nodoc:
63
63
  post[:managedCustomerID]=billing_id
64
64
  add_creditcard(post, creditcard)
65
65
  add_address(post, billing_address)
66
- add_misc_fields(post, billing_address)
66
+ add_misc_fields(post, options)
67
67
 
68
68
  commit("UpdateCustomer", post)
69
69
  end
70
70
 
71
- #process payment for given amount from stored CC "ManagedCustomerID = billing_id"
71
+ # Process a payment in the given amount against the stored credit card given by billing_id
72
+ #
73
+ # ==== Parameters
74
+ #
75
+ # * <tt>money</tt> -- The amount to be purchased as an Integer value in cents.
76
+ # * <tt>billing_id</tt> -- The eWay provided card/customer token to charge (managedCustomerID)
77
+ # * <tt>options</tt> -- A hash of optional parameters.
78
+ #
79
+ # ==== Options
80
+ #
81
+ # * <tt>:order_id</tt> -- The order number, passed to eWay as the "Invoice Reference"
82
+ # * <tt>:invoice</tt> -- The invoice number, passed to eWay as the "Invoice Reference" unless :order_id is also given
83
+ # * <tt>:description</tt> -- A description of the payment, passed to eWay as the "Invoice Description"
72
84
  def purchase(money, billing_id, options={})
73
85
  post = {}
74
86
  post[:managedCustomerID] = billing_id.to_s
75
87
  post[:amount]=money
76
-
88
+ add_invoice(post, options)
89
+
77
90
  commit("ProcessPayment", post)
78
91
  end
79
92
 
@@ -102,14 +115,21 @@ private
102
115
  end
103
116
 
104
117
  def add_misc_fields(post, options)
105
- post[:CustomerRef]=options[:customer_ref].to_s
106
- post[:Title]=options[:title]
107
- post[:Company]=options[:company]
108
- post[:JobDesc]=options[:job_desc]
109
- post[:Email]=options[:email]
110
- post[:URL]=options[:url]
118
+ post[:CustomerRef]=options[:billing_address][:customer_ref] || options[:customer]
119
+ post[:Title]=options[:billing_address][:title]
120
+ post[:Company]=options[:billing_address][:company]
121
+ post[:JobDesc]=options[:billing_address][:job_desc]
122
+ post[:Email]=options[:billing_address][:email] || options[:email]
123
+ post[:URL]=options[:billing_address][:url]
124
+ post[:Comments]=options[:description]
125
+ end
126
+
127
+ def add_invoice(post, options)
128
+ post[:invoiceReference] = options[:order_id] || options[:invoice]
129
+ post[:invoiceDescription] = options[:description]
111
130
  end
112
131
 
132
+
113
133
  # add credit card details to be stored by eway. NOTE eway requires "title" field
114
134
  def add_creditcard(post, creditcard)
115
135
  post[:CCNumber] = creditcard.number
@@ -188,7 +208,12 @@ private
188
208
  # Where we build the full SOAP 1.2 request using builder
189
209
  def soap_request(arguments, action)
190
210
  # eWay demands all fields be sent, but contain an empty string if blank
191
- post=default_fields.merge(arguments)
211
+ post = case action
212
+ when 'ProcessPayment'
213
+ default_payment_fields.merge(arguments)
214
+ else
215
+ default_customer_fields.merge(arguments)
216
+ end
192
217
 
193
218
  xml = Builder::XmlMarkup.new :indent => 2
194
219
  xml.instruct!
@@ -211,7 +236,7 @@ private
211
236
  xml.target!
212
237
  end
213
238
 
214
- def default_fields
239
+ def default_customer_fields
215
240
  hash={}
216
241
  %w( CustomerRef Title FirstName LastName Company JobDesc Email Address Suburb State PostCode Country Phone Mobile Fax URL Comments CCNumber CCNameOnCard CCExpiryMonth CCExpiryYear ).each do |field|
217
242
  hash[field.to_sym]=''
@@ -219,6 +244,14 @@ private
219
244
  return hash
220
245
  end
221
246
 
247
+ def default_payment_fields
248
+ hash={}
249
+ %w( managedCustomerID amount invoiceReference invoiceDescription ).each do |field|
250
+ hash[field.to_sym]=''
251
+ end
252
+ return hash
253
+ end
254
+
222
255
  class EwayResponse < Response
223
256
  # add a method to response so we can easily get the eway token "ManagedCustomerID"
224
257
  def token
@@ -49,6 +49,10 @@ module ActiveMerchant #:nodoc:
49
49
  commit('ccSettlement', money, options)
50
50
  end
51
51
 
52
+ def test?
53
+ super || @options[:test]
54
+ end
55
+
52
56
  private
53
57
 
54
58
  def parse_card_or_auth(card_or_auth, options)
@@ -115,6 +115,10 @@ module ActiveMerchant #:nodoc:
115
115
  commit(:query, nil, {})
116
116
  end
117
117
 
118
+ def test?
119
+ @options[:test] || super
120
+ end
121
+
118
122
  private
119
123
 
120
124
  def hosted?
@@ -197,7 +197,7 @@ module ActiveMerchant
197
197
 
198
198
  if shipping_address
199
199
  xml.tag! 'address', 'type' => 'shipping' do
200
- xml.tag! 'code', shipping_address[:zip]
200
+ xml.tag! 'code', avs_input_code( shipping_address )
201
201
  xml.tag! 'country', shipping_address[:country]
202
202
  end
203
203
  end
@@ -0,0 +1,30 @@
1
+ # All mappings in helper.rb are required fields to be sent to Dwolla.
2
+ # :account = 'Dwolla Id of merchant'
3
+ # :credential1 = 'key from Dwolla Application'
4
+ # :credential2 = 'secret from Dwolla Application'
5
+ # :redirect_url = 'can be different that what is specified on Dwolla Application creation'
6
+ # :return_url = 'can be different that what is specified on Dwolla Application creation'
7
+ # :order_id = must be unique for each transaction
8
+
9
+ module ActiveMerchant #:nodoc:
10
+ module Billing #:nodoc:
11
+ module Integrations #:nodoc:
12
+ module Dwolla
13
+ autoload :Return, 'active_merchant/billing/integrations/dwolla/return.rb'
14
+ autoload :Helper, 'active_merchant/billing/integrations/dwolla/helper.rb'
15
+ autoload :Notification, 'active_merchant/billing/integrations/dwolla/notification.rb'
16
+
17
+ mattr_accessor :service_url
18
+ self.service_url = 'https://www.dwolla.com/payment/pay'
19
+
20
+ def self.notification(post)
21
+ Notification.new(post)
22
+ end
23
+
24
+ def self.return(query_string)
25
+ Return.new(query_string)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module Dwolla
5
+ class Helper < ActiveMerchant::Billing::Integrations::Helper
6
+
7
+ def initialize(order, account, options = {})
8
+ super
9
+ add_field('name', 'Store Purchase')
10
+ end
11
+
12
+ # Replace with the real mapping
13
+ mapping :credential1, 'key'
14
+ mapping :credential2, 'secret'
15
+ mapping :notify_url, 'callback'
16
+ mapping :return_url, 'redirect'
17
+ mapping :test_mode, 'test'
18
+ mapping :description, 'description'
19
+ mapping :account, 'destinationid'
20
+ mapping :amount, 'amount'
21
+ mapping :tax, 'tax'
22
+ mapping :shipping, 'shipping'
23
+ mapping :order, 'orderid'
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,50 @@
1
+ require 'net/http'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ module Integrations #:nodoc:
6
+ module Dwolla
7
+ class Notification < ActiveMerchant::Billing::Integrations::Notification
8
+ def complete?
9
+ status == "Completed"
10
+ end
11
+
12
+ def status
13
+ params["Status"]
14
+ end
15
+
16
+ def transaction_id
17
+ params['OrderId']
18
+ end
19
+
20
+ def currency
21
+ "USD"
22
+ end
23
+
24
+ def gross
25
+ params['Amount']
26
+ end
27
+
28
+ def error
29
+ params['Message']
30
+ end
31
+
32
+ # Was this a test transaction?
33
+ def test?
34
+ params['TestMode']
35
+ end
36
+
37
+ def acknowledge
38
+ true
39
+ end
40
+ private
41
+ # Take the posted data and move the relevant data into a hash
42
+ def parse(post)
43
+ json_post = JSON.parse(post)
44
+ params.merge!(json_post)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,38 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module Dwolla
5
+ class Return < ActiveMerchant::Billing::Integrations::Return
6
+
7
+ def success?
8
+ self.error.nil? && self.callback_success?
9
+ end
10
+
11
+ def error
12
+ params['error']
13
+ end
14
+
15
+ def error_description
16
+ params['error_description']
17
+ end
18
+
19
+ def checkout_id
20
+ params['checkoutid']
21
+ end
22
+
23
+ def transaction
24
+ params['transaction']
25
+ end
26
+
27
+ def test?
28
+ params['test']
29
+ end
30
+
31
+ def callback_success?
32
+ params['postback'] != "failure"
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -68,7 +68,7 @@ module ActiveMerchant #:nodoc:
68
68
 
69
69
 
70
70
  mattr_accessor :service_url
71
- self.service_url = 'https://www.nochex.com/nochex.dll/checkout'
71
+ self.service_url = 'https://secure.nochex.com'
72
72
 
73
73
  mattr_accessor :notification_confirmation_url
74
74
  self.notification_confirmation_url = 'https://www.nochex.com/nochex.dll/apc/apc'
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = "1.17.0"
2
+ VERSION = "1.18.0"
3
3
  end
metadata CHANGED
@@ -1,42 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- hash: 83
4
+ hash: 95
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 17
8
+ - 18
9
9
  - 0
10
- version: 1.17.0
10
+ version: 1.18.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Luetke
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain:
17
- - |
18
- -----BEGIN CERTIFICATE-----
19
- MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMRMwEQYDVQQDDApjb2R5
20
- ZmF1c2VyMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNj
21
- b20wHhcNMDcwMjIyMTcyMTI3WhcNMDgwMjIyMTcyMTI3WjBBMRMwEQYDVQQDDApj
22
- b2R5ZmF1c2VyMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
23
- FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6T4Iqt5iWvAlU
24
- iXI6L8UO0URQhIC65X/gJ9hL/x4lwSl/ckVm/R/bPrJGmifT+YooFv824N3y/TIX
25
- 25o/lZtRj1TUZJK4OCb0aVzosQVxBHSe6rLmxO8cItNTMOM9wn3thaITFrTa1DOQ
26
- O3wqEjvW2L6VMozVfK1MfjL9IGgy0rCnl+2g4Gh4jDDpkLfnMG5CWI6cTCf3C1ye
27
- ytOpWgi0XpOEy8nQWcFmt/KCQ/kFfzBo4QxqJi54b80842EyvzWT9OB7Oew/CXZG
28
- F2yIHtiYxonz6N09vvSzq4CvEuisoUFLKZnktndxMEBKwJU3XeSHAbuS7ix40OKO
29
- WKuI54fHAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
30
- BBR9QQpefI3oDCAxiqJW/3Gg6jI6qjANBgkqhkiG9w0BAQUFAAOCAQEAs0lX26O+
31
- HpyMp7WL+SgZuM8k76AjfOHuKajl2GEn3S8pWYGpsa0xu07HtehJhKLiavrfUYeE
32
- qlFtyYMUyOh6/1S2vfkH6VqjX7mWjoi7XKHW/99fkMS40B5SbN+ypAUst+6c5R84
33
- w390mjtLHpdDE6WQYhS6bFvBN53vK6jG3DLyCJc0K9uMQ7gdHWoxq7RnG92ncQpT
34
- ThpRA+fky5Xt2Q63YJDnJpkYAz79QIama1enSnd4jslKzSl89JS2luq/zioPe/Us
35
- hbyalWR1+HrhgPoSPq7nk+s2FQUBJ9UZFK1lgMzho/4fZgzJwbu+cO8SNuaLS/bj
36
- hPaSTyVU0yCSnw==
37
- -----END CERTIFICATE-----
38
-
39
- date: 2011-08-23 00:00:00 -04:00
17
+ - gem-public_cert.pem
18
+ date: 2011-09-23 00:00:00 -04:00
40
19
  default_executable:
41
20
  dependencies:
42
21
  - !ruby/object:Gem::Dependency
@@ -58,6 +37,34 @@ dependencies:
58
37
  - !ruby/object:Gem::Dependency
59
38
  type: :runtime
60
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ name: i18n
49
+ version_requirements: *id002
50
+ prerelease: false
51
+ - !ruby/object:Gem::Dependency
52
+ type: :runtime
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ name: money
63
+ version_requirements: *id003
64
+ prerelease: false
65
+ - !ruby/object:Gem::Dependency
66
+ type: :runtime
67
+ requirement: &id004 !ruby/object:Gem::Requirement
61
68
  none: false
62
69
  requirements:
63
70
  - - ">="
@@ -69,11 +76,11 @@ dependencies:
69
76
  - 0
70
77
  version: 2.0.0
71
78
  name: builder
72
- version_requirements: *id002
79
+ version_requirements: *id004
73
80
  prerelease: false
74
81
  - !ruby/object:Gem::Dependency
75
82
  type: :runtime
76
- requirement: &id003 !ruby/object:Gem::Requirement
83
+ requirement: &id005 !ruby/object:Gem::Requirement
77
84
  none: false
78
85
  requirements:
79
86
  - - ">="
@@ -85,11 +92,11 @@ dependencies:
85
92
  - 0
86
93
  version: 2.0.0
87
94
  name: braintree
88
- version_requirements: *id003
95
+ version_requirements: *id005
89
96
  prerelease: false
90
97
  - !ruby/object:Gem::Dependency
91
98
  type: :runtime
92
- requirement: &id004 !ruby/object:Gem::Requirement
99
+ requirement: &id006 !ruby/object:Gem::Requirement
93
100
  none: false
94
101
  requirements:
95
102
  - - ">="
@@ -101,7 +108,67 @@ dependencies:
101
108
  - 1
102
109
  version: 1.5.1
103
110
  name: json
104
- version_requirements: *id004
111
+ version_requirements: *id006
112
+ prerelease: false
113
+ - !ruby/object:Gem::Dependency
114
+ type: :runtime
115
+ requirement: &id007 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ hash: 21
121
+ segments:
122
+ - 1
123
+ - 0
124
+ - 1
125
+ version: 1.0.1
126
+ name: active_utils
127
+ version_requirements: *id007
128
+ prerelease: false
129
+ - !ruby/object:Gem::Dependency
130
+ type: :development
131
+ requirement: &id008 !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ hash: 3
137
+ segments:
138
+ - 0
139
+ version: "0"
140
+ name: rake
141
+ version_requirements: *id008
142
+ prerelease: false
143
+ - !ruby/object:Gem::Dependency
144
+ type: :development
145
+ requirement: &id009 !ruby/object:Gem::Requirement
146
+ none: false
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ hash: 3
151
+ segments:
152
+ - 0
153
+ version: "0"
154
+ name: mocha
155
+ version_requirements: *id009
156
+ prerelease: false
157
+ - !ruby/object:Gem::Dependency
158
+ type: :development
159
+ requirement: &id010 !ruby/object:Gem::Requirement
160
+ none: false
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ hash: 21
165
+ segments:
166
+ - 2
167
+ - 3
168
+ - 11
169
+ version: 2.3.11
170
+ name: rails
171
+ version_requirements: *id010
105
172
  prerelease: false
106
173
  description: Active Merchant is a simple payment abstraction library used in and sponsored by Shopify. It is written by Tobias Luetke, Cody Fauser, and contributors. The aim of the project is to feel natural to Ruby users and to abstract as many parts as possible away from the user to offer a consistent interface across all supported gateways.
107
174
  email: tobi@leetsoft.com
@@ -237,6 +304,10 @@ files:
237
304
  - lib/active_merchant/billing/integrations/directebanking/notification.rb
238
305
  - lib/active_merchant/billing/integrations/directebanking/return.rb
239
306
  - lib/active_merchant/billing/integrations/directebanking.rb
307
+ - lib/active_merchant/billing/integrations/dwolla/helper.rb
308
+ - lib/active_merchant/billing/integrations/dwolla/notification.rb
309
+ - lib/active_merchant/billing/integrations/dwolla/return.rb
310
+ - lib/active_merchant/billing/integrations/dwolla.rb
240
311
  - lib/active_merchant/billing/integrations/e_payment_plans/helper.rb
241
312
  - lib/active_merchant/billing/integrations/e_payment_plans/notification.rb
242
313
  - lib/active_merchant/billing/integrations/e_payment_plans.rb
@@ -289,19 +360,9 @@ files:
289
360
  - lib/active_merchant/billing/integrations.rb
290
361
  - lib/active_merchant/billing/response.rb
291
362
  - lib/active_merchant/billing.rb
292
- - lib/active_merchant/common/connection.rb
293
- - lib/active_merchant/common/country.rb
294
- - lib/active_merchant/common/error.rb
295
- - lib/active_merchant/common/post_data.rb
296
- - lib/active_merchant/common/posts_data.rb
297
- - lib/active_merchant/common/requires_parameters.rb
298
- - lib/active_merchant/common/utils.rb
299
- - lib/active_merchant/common/validateable.rb
300
- - lib/active_merchant/common.rb
301
363
  - lib/active_merchant/version.rb
302
364
  - lib/active_merchant.rb
303
365
  - lib/activemerchant.rb
304
- - lib/certs/cacert.pem
305
366
  - lib/support/gateway_support.rb
306
367
  - lib/support/outbound_hosts.rb
307
368
  has_rdoc: true