activemerchant 1.15.0 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +21 -0
  3. data/CONTRIBUTORS +13 -1
  4. data/lib/active_merchant.rb +2 -5
  5. data/lib/active_merchant/billing/avs_result.rb +2 -2
  6. data/lib/active_merchant/billing/credit_card.rb +6 -0
  7. data/lib/active_merchant/billing/gateways/authorize_net.rb +1 -1
  8. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +1 -2
  9. data/lib/active_merchant/billing/gateways/bogus.rb +34 -24
  10. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -1
  11. data/lib/active_merchant/billing/gateways/cyber_source.rb +20 -0
  12. data/lib/active_merchant/billing/gateways/moneris.rb +1 -1
  13. data/lib/active_merchant/billing/gateways/orbital.rb +6 -2
  14. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
  15. data/lib/active_merchant/billing/gateways/paystation.rb +201 -0
  16. data/lib/active_merchant/billing/gateways/qbms.rb +1 -3
  17. data/lib/active_merchant/billing/gateways/quickpay.rb +56 -51
  18. data/lib/active_merchant/billing/gateways/stripe.rb +212 -0
  19. data/lib/active_merchant/billing/gateways/worldpay.rb +1 -1
  20. data/lib/active_merchant/billing/integrations/action_view_helper.rb +2 -2
  21. data/lib/active_merchant/billing/integrations/e_payment_plans.rb +48 -0
  22. data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +34 -0
  23. data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +84 -0
  24. data/lib/active_merchant/billing/integrations/helper.rb +3 -3
  25. data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +11 -0
  26. data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +16 -7
  27. data/lib/active_merchant/billing/integrations/world_pay.rb +4 -15
  28. data/lib/active_merchant/version.rb +1 -1
  29. metadata +46 -21
  30. metadata.gz.sig +0 -0
  31. data/README.rdoc +0 -164
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
7
7
  self.default_currency = 'GBP'
8
8
  self.money_format = :cents
9
9
  self.supported_countries = ['HK', 'US', 'GB', 'AU']
10
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
10
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro]
11
11
  self.homepage_url = 'http://www.worldpay.com/'
12
12
  self.display_name = 'WorldPay'
13
13
 
@@ -1,4 +1,4 @@
1
- require_library_or_gem 'action_pack'
1
+ require 'action_pack'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
21
21
  # <% service.customer :first_name => 'Cody',
22
22
  # :last_name => 'Fauser',
23
23
  # :phone => '(555)555-5555',
24
- # :email => 'codyfauser@gmail.com' %>
24
+ # :email => 'cody@example.com' %>
25
25
  #
26
26
  # <% service.billing_address :city => 'Ottawa',
27
27
  # :address1 => '21 Snowy Brook Lane',
@@ -0,0 +1,48 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module EPaymentPlans
5
+ autoload :Helper, File.dirname(__FILE__) + '/e_payment_plans/helper.rb'
6
+ autoload :Notification, File.dirname(__FILE__) + '/e_payment_plans/notification.rb'
7
+
8
+ mattr_accessor :production_url
9
+ self.production_url = 'https://www.epaymentplans.com'
10
+
11
+ mattr_accessor :test_url
12
+ self.test_url = 'https://test.epaymentplans.com'
13
+
14
+ def self.service_url
15
+ mode = ActiveMerchant::Billing::Base.integration_mode
16
+ case mode
17
+ when :production
18
+ "#{production_url}/order/purchase"
19
+ when :test
20
+ "#{test_url}/order/purchase"
21
+ else
22
+ raise StandardError, "Integration mode set to an invalid value: #{mode}"
23
+ end
24
+ end
25
+
26
+ def self.notification_confirmation_url
27
+ mode = ActiveMerchant::Billing::Base.integration_mode
28
+ case mode
29
+ when :production
30
+ "#{production_url}/order/confirmation"
31
+ when :test
32
+ "#{test_url}/order/confirmation"
33
+ else
34
+ raise StandardError, "Integration mode set to an invalid value: #{mode}"
35
+ end
36
+ end
37
+
38
+ def self.notification(post, options = {})
39
+ Notification.new(post, options)
40
+ end
41
+
42
+ def self.return(query_string, options = {})
43
+ Return.new(query_string, options)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,34 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module EPaymentPlans
5
+ class Helper < ActiveMerchant::Billing::Integrations::Helper
6
+ mapping :account, 'order[account]'
7
+ mapping :amount, 'order[amount]'
8
+
9
+ mapping :order, 'order[num]'
10
+
11
+ mapping :customer, :first_name => 'order[first_name]',
12
+ :last_name => 'order[last_name]',
13
+ :email => 'order[email]',
14
+ :phone => 'order[phone]'
15
+
16
+ mapping :billing_address, :city => 'order[city]',
17
+ :address1 => 'order[address1]',
18
+ :address2 => 'order[address2]',
19
+ :company => 'order[company]',
20
+ :state => 'order[state]',
21
+ :zip => 'order[zip]',
22
+ :country => 'order[country]'
23
+
24
+ mapping :notify_url, 'order[notify_url]'
25
+ mapping :return_url, 'order[return_url]'
26
+ mapping :cancel_return_url, 'order[cancel_return_url]'
27
+ mapping :description, 'order[description]'
28
+ mapping :tax, 'order[tax]'
29
+ mapping :shipping, 'order[shipping]'
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,84 @@
1
+ require 'net/http'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ module Integrations #:nodoc:
6
+ module EPaymentPlans
7
+ class Notification < ActiveMerchant::Billing::Integrations::Notification
8
+ include ActiveMerchant::PostsData
9
+ def complete?
10
+ status == "Completed"
11
+ end
12
+
13
+ def transaction_id
14
+ params['transaction_id']
15
+ end
16
+
17
+ def item_id
18
+ params['item_id']
19
+ end
20
+
21
+ # When was this payment received by the client.
22
+ def received_at
23
+ Time.parse(params['received_at'].to_s).utc
24
+ end
25
+
26
+ def gross
27
+ params['gross']
28
+ end
29
+
30
+ def currency
31
+ params['currency']
32
+ end
33
+
34
+ def security_key
35
+ params['security_key']
36
+ end
37
+
38
+ # Was this a test transaction?
39
+ def test?
40
+ params['test'] == 'test'
41
+ end
42
+
43
+ def status
44
+ params['status'].capitalize
45
+ end
46
+
47
+ # Acknowledge the transaction to EPaymentPlans. This method has to be called after a new
48
+ # apc arrives. EPaymentPlans will verify that all the information we received are correct
49
+ # and will return ok or a fail.
50
+ #
51
+ # Example:
52
+ #
53
+ # def ipn
54
+ # notify = EPaymentPlans.notification(request.raw_post)
55
+ #
56
+ # if notify.acknowledge
57
+ # ... process order ... if notify.complete?
58
+ # else
59
+ # ... log possible hacking attempt ...
60
+ # end
61
+ def acknowledge
62
+ payload = raw
63
+
64
+ response = ssl_post(EPaymentPlans.notification_confirmation_url, payload)
65
+
66
+ # Replace with the appropriate codes
67
+ raise StandardError.new("Faulty EPaymentPlans result: #{response}") unless ["AUTHORISED", "DECLINED"].include?(response)
68
+ response == "AUTHORISED"
69
+ end
70
+
71
+ private
72
+ # Take the posted data and move the relevant data into a hash
73
+ def parse(post)
74
+ @raw = post
75
+ for line in post.split('&')
76
+ key, value = *line.scan( %r{^(\w+)\=(.*)$} ).flatten
77
+ params[key] = value
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
@@ -14,7 +14,7 @@ module ActiveMerchant #:nodoc:
14
14
  self.application_id = 'ActiveMerchant'
15
15
 
16
16
  def initialize(order, account, options = {})
17
- options.assert_valid_keys([:amount, :currency, :test, :credential2, :credential3, :credential4])
17
+ options.assert_valid_keys([:amount, :currency, :test, :credential2, :credential3, :credential4, :country, :account_name])
18
18
  @fields = {}
19
19
  self.order = order
20
20
  self.account = account
@@ -64,9 +64,9 @@ module ActiveMerchant #:nodoc:
64
64
  add_fields(key, params)
65
65
  end
66
66
 
67
- def lookup_country_code(name_or_code)
67
+ def lookup_country_code(name_or_code, format = country_format)
68
68
  country = Country.find(name_or_code)
69
- country.code(country_format).to_s
69
+ country.code(format).to_s
70
70
  rescue InvalidCountryCodeError
71
71
  name_or_code
72
72
  end
@@ -30,6 +30,8 @@ module ActiveMerchant #:nodoc:
30
30
  def initialize(order, account, options = {})
31
31
  super
32
32
  add_tracking_token
33
+ add_default_parameters
34
+ add_seller_details(options)
33
35
  end
34
36
 
35
37
 
@@ -41,6 +43,15 @@ module ActiveMerchant #:nodoc:
41
43
  add_field('merchant_fields', 'platform')
42
44
  add_field('platform', application_id)
43
45
  end
46
+
47
+ def add_default_parameters
48
+ add_field('hide_login', 1)
49
+ end
50
+
51
+ def add_seller_details(options)
52
+ add_field('recipient_description', options[:account_name]) if options[:account_name]
53
+ add_field('country', lookup_country_code(options[:country], :alpha3)) if options[:country]
54
+ end
44
55
  end
45
56
  end
46
57
  end
@@ -6,7 +6,7 @@ module ActiveMerchant #:nodoc:
6
6
  module Valitor
7
7
  module ResponseFields
8
8
  def success?
9
- acknowledge
9
+ status == 'Completed'
10
10
  end
11
11
  alias :complete? :success?
12
12
 
@@ -14,20 +14,29 @@ module ActiveMerchant #:nodoc:
14
14
  @options[:test]
15
15
  end
16
16
 
17
- def order
17
+ def item_id
18
18
  params['Tilvisunarnumer']
19
19
  end
20
-
21
- def received_at
22
- params['Dagsetning']
23
- end
20
+ alias :order :item_id
24
21
 
25
22
  def transaction_id
26
23
  params['VefverslunSalaID']
27
24
  end
28
25
 
26
+ def currency
27
+ nil
28
+ end
29
+
29
30
  def status
30
- "OK"
31
+ "Completed" if acknowledge
32
+ end
33
+
34
+ def received_at
35
+ Time.parse(params['Dagsetning'].to_s)
36
+ end
37
+
38
+ def gross
39
+ "%0.2f" % params['Upphaed'].to_s
31
40
  end
32
41
 
33
42
  def card_type
@@ -6,23 +6,12 @@ module ActiveMerchant #:nodoc:
6
6
  module Integrations #:nodoc:
7
7
  module WorldPay
8
8
 
9
+ # production and test have the same endpoint
9
10
  mattr_accessor :production_url
10
- self.production_url = 'https://select.worldpay.com/wcc/purchase'
11
-
12
- mattr_accessor :test_url
13
- self.test_url = 'https://select-test.worldpay.com/wcc/purchase'
14
-
15
-
11
+ self.production_url = 'https://secure.wp3.rbsworldpay.com/wcc/purchase'
12
+
16
13
  def self.service_url
17
- mode = ActiveMerchant::Billing::Base.integration_mode
18
- case mode
19
- when :production
20
- production_url
21
- when :test
22
- test_url
23
- else
24
- raise StandardError, "Integration mode set to an invalid value: #{mode}"
25
- end
14
+ production_url
26
15
  end
27
16
 
28
17
  def self.notification(post, options = {})
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = "1.15.0"
2
+ VERSION = "1.16.0"
3
3
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 87
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
- - 15
8
+ - 16
8
9
  - 0
9
- version: 1.15.0
10
+ version: 1.16.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Tobias Luetke
@@ -35,54 +36,73 @@ cert_chain:
35
36
  hPaSTyVU0yCSnw==
36
37
  -----END CERTIFICATE-----
37
38
 
38
- date: 2011-05-12 00:00:00 -04:00
39
+ date: 2011-07-18 00:00:00 -04:00
39
40
  default_executable:
40
41
  dependencies:
41
42
  - !ruby/object:Gem::Dependency
42
- name: activesupport
43
- requirement: &id001 !ruby/object:Gem::Requirement
43
+ prerelease: false
44
+ type: :runtime
45
+ version_requirements: &id001 !ruby/object:Gem::Requirement
44
46
  none: false
45
47
  requirements:
46
48
  - - ">="
47
49
  - !ruby/object:Gem::Version
50
+ hash: 21
48
51
  segments:
49
52
  - 2
50
53
  - 3
51
- - 8
52
- version: 2.3.8
53
- type: :runtime
54
- prerelease: false
55
- version_requirements: *id001
54
+ - 11
55
+ version: 2.3.11
56
+ requirement: *id001
57
+ name: activesupport
56
58
  - !ruby/object:Gem::Dependency
57
- name: builder
58
- requirement: &id002 !ruby/object:Gem::Requirement
59
+ prerelease: false
60
+ type: :runtime
61
+ version_requirements: &id002 !ruby/object:Gem::Requirement
59
62
  none: false
60
63
  requirements:
61
64
  - - ">="
62
65
  - !ruby/object:Gem::Version
66
+ hash: 15
63
67
  segments:
64
68
  - 2
65
69
  - 0
66
70
  - 0
67
71
  version: 2.0.0
68
- type: :runtime
69
- prerelease: false
70
- version_requirements: *id002
72
+ requirement: *id002
73
+ name: builder
71
74
  - !ruby/object:Gem::Dependency
72
- name: braintree
73
- requirement: &id003 !ruby/object:Gem::Requirement
75
+ prerelease: false
76
+ type: :runtime
77
+ version_requirements: &id003 !ruby/object:Gem::Requirement
74
78
  none: false
75
79
  requirements:
76
80
  - - ">="
77
81
  - !ruby/object:Gem::Version
82
+ hash: 15
78
83
  segments:
79
84
  - 2
80
85
  - 0
81
86
  - 0
82
87
  version: 2.0.0
83
- type: :runtime
88
+ requirement: *id003
89
+ name: braintree
90
+ - !ruby/object:Gem::Dependency
84
91
  prerelease: false
85
- version_requirements: *id003
92
+ type: :runtime
93
+ version_requirements: &id004 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 1
99
+ segments:
100
+ - 1
101
+ - 5
102
+ - 1
103
+ version: 1.5.1
104
+ requirement: *id004
105
+ name: json
86
106
  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.
87
107
  email: tobi@leetsoft.com
88
108
  executables: []
@@ -93,7 +113,6 @@ extra_rdoc_files: []
93
113
 
94
114
  files:
95
115
  - CHANGELOG
96
- - README.rdoc
97
116
  - MIT-LICENSE
98
117
  - CONTRIBUTORS
99
118
  - gem-public_cert.pem
@@ -168,6 +187,7 @@ files:
168
187
  - lib/active_merchant/billing/gateways/paypal_ca.rb
169
188
  - lib/active_merchant/billing/gateways/paypal_express.rb
170
189
  - lib/active_merchant/billing/gateways/paypal_express_common.rb
190
+ - lib/active_merchant/billing/gateways/paystation.rb
171
191
  - lib/active_merchant/billing/gateways/plugnpay.rb
172
192
  - lib/active_merchant/billing/gateways/psigate.rb
173
193
  - lib/active_merchant/billing/gateways/psl_card.rb
@@ -187,6 +207,7 @@ files:
187
207
  - lib/active_merchant/billing/gateways/secure_pay_tech.rb
188
208
  - lib/active_merchant/billing/gateways/skip_jack.rb
189
209
  - lib/active_merchant/billing/gateways/smart_ps.rb
210
+ - lib/active_merchant/billing/gateways/stripe.rb
190
211
  - lib/active_merchant/billing/gateways/trans_first.rb
191
212
  - lib/active_merchant/billing/gateways/transax.rb
192
213
  - lib/active_merchant/billing/gateways/trust_commerce.rb
@@ -214,6 +235,9 @@ files:
214
235
  - lib/active_merchant/billing/integrations/directebanking/notification.rb
215
236
  - lib/active_merchant/billing/integrations/directebanking/return.rb
216
237
  - lib/active_merchant/billing/integrations/directebanking.rb
238
+ - lib/active_merchant/billing/integrations/e_payment_plans/helper.rb
239
+ - lib/active_merchant/billing/integrations/e_payment_plans/notification.rb
240
+ - lib/active_merchant/billing/integrations/e_payment_plans.rb
217
241
  - lib/active_merchant/billing/integrations/gestpay/common.rb
218
242
  - lib/active_merchant/billing/integrations/gestpay/helper.rb
219
243
  - lib/active_merchant/billing/integrations/gestpay/notification.rb
@@ -289,7 +313,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
289
313
  requirements:
290
314
  - - ">="
291
315
  - !ruby/object:Gem::Version
292
- hash: 407104905764746451
316
+ hash: 3
293
317
  segments:
294
318
  - 0
295
319
  version: "0"
@@ -298,6 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
322
  requirements:
299
323
  - - ">="
300
324
  - !ruby/object:Gem::Version
325
+ hash: 3
301
326
  segments:
302
327
  - 0
303
328
  version: "0"