activemerchant 1.4.1 → 1.4.2
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 +28 -0
- data/Rakefile +2 -4
- data/lib/active_merchant/billing/credit_card.rb +2 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +13 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -1
- data/lib/active_merchant/billing/gateways/bogus.rb +13 -1
- data/lib/active_merchant/billing/gateways/braintree.rb +13 -5
- data/lib/active_merchant/billing/gateways/card_stream.rb +1 -5
- data/lib/active_merchant/billing/gateways/moneris.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_junction.rb +9 -3
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +2 -8
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/psl_card.rb +7 -3
- data/lib/active_merchant/billing/gateways/quickpay.rb +84 -54
- data/lib/active_merchant/billing/gateways/sage.rb +1 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +5 -1
- data/lib/active_merchant/billing/gateways/wirecard.rb +20 -19
- data/lib/active_merchant/billing/integrations.rb +1 -0
- data/lib/active_merchant/billing/integrations/quickpay.rb +18 -0
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +72 -0
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +74 -0
- data/lib/active_merchant/lib/country.rb +21 -3
- data/lib/active_merchant/lib/posts_data.rb +54 -34
- data/lib/active_merchant/lib/requires_parameters.rb +1 -1
- data/test/fixtures.yml +19 -3
- data/test/remote/gateways/remote_braintree_test.rb +11 -4
- data/test/remote/gateways/remote_card_stream_test.rb +20 -20
- data/test/remote/gateways/remote_psl_card_test.rb +23 -4
- data/test/remote/gateways/remote_quickpay_test.rb +17 -9
- data/test/remote/gateways/remote_wirecard_test.rb +3 -2
- data/test/test_helper.rb +3 -2
- data/test/unit/credit_card_test.rb +7 -0
- data/test/unit/gateways/authorize_net_cim_test.rb +2 -5
- data/test/unit/gateways/authorize_net_test.rb +16 -6
- data/test/unit/gateways/bogus_test.rb +4 -0
- data/test/unit/gateways/moneris_test.rb +1 -1
- data/test/unit/gateways/payflow_test.rb +6 -2
- data/test/unit/gateways/quickpay_test.rb +8 -8
- data/test/unit/gateways/trust_commerce_test.rb +12 -0
- data/test/unit/integrations/helpers/quickpay_helper_test.rb +40 -0
- data/test/unit/integrations/notifications/quickpay_notification_test.rb +69 -0
- data/test/unit/integrations/quickpay_module_test.rb +9 -0
- metadata +10 -5
- metadata.gz.sig +0 -0
- data/lib/tasks/cia.rb +0 -90
@@ -13,7 +13,7 @@ class QuickpayTest < Test::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_successful_purchase
|
16
|
-
@gateway.expects(:ssl_post).
|
16
|
+
@gateway.expects(:ssl_post).returns(successful_authorization_response, successful_capture_response)
|
17
17
|
|
18
18
|
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
19
19
|
assert_success response
|
@@ -45,8 +45,8 @@ class QuickpayTest < Test::Unit::TestCase
|
|
45
45
|
response = @gateway.purchase(@amount, @credit_card, @options)
|
46
46
|
assert_failure response
|
47
47
|
assert_equal '008', response.params['qpstat']
|
48
|
-
assert_equal 'Missing/error in
|
49
|
-
assert_equal 'Missing/error in cardnumber, Missing/error in expirationdate, Missing/error in card verification data, Missing/error in amount, Missing/error in ordernum,
|
48
|
+
assert_equal 'Missing/error in cardnumber, Missing/error in expirationdate, Missing/error in card verification data, Missing/error in amount, Missing/error in ordernum, Missing/error in currency', response.params['qpstatmsg']
|
49
|
+
assert_equal 'Missing/error in cardnumber, Missing/error in expirationdate, Missing/error in card verification data, Missing/error in amount, Missing/error in ordernum, Missing/error in currency', response.message
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_merchant_error
|
@@ -91,22 +91,22 @@ class QuickpayTest < Test::Unit::TestCase
|
|
91
91
|
private
|
92
92
|
|
93
93
|
def error_response
|
94
|
-
"<?xml version='1.0' encoding='ISO-8859-1'?><
|
94
|
+
"<?xml version='1.0' encoding='ISO-8859-1'?><response><qpstat>008</qpstat><qpstatmsg>Missing/error in cardnumber, Missing/error in expirationdate, Missing/error in card verification data, Missing/error in amount, Missing/error in ordernum, Missing/error in currency</qpstatmsg></response>"
|
95
95
|
end
|
96
96
|
|
97
97
|
def merchant_error
|
98
|
-
"<?xml version='1.0' encoding='ISO-8859-1'?><
|
98
|
+
"<?xml version='1.0' encoding='ISO-8859-1'?><response><qpstat>008</qpstat><qpstatmsg>Missing/error in merchant</qpstatmsg></response>"
|
99
99
|
end
|
100
100
|
|
101
101
|
def successful_authorization_response
|
102
|
-
"<?xml version='1.0' encoding='ISO-8859-1'?><
|
102
|
+
"<?xml version='1.0' encoding='ISO-8859-1'?><response><qpstat>000</qpstat><transaction>2865261</transaction><time>070425223705</time><ordernum>104680</ordernum><merchantemail>cody@example.com</merchantemail><pbsstat>000</pbsstat><cardtype>Visa</cardtype><amount>100</amount><qpstatmsg>OK</qpstatmsg><merchant>Shopify</merchant><msgtype>1110</msgtype><currency>USD</currency></response>"
|
103
103
|
end
|
104
104
|
|
105
105
|
def successful_capture_response
|
106
|
-
'<?xml version="1.0" encoding="ISO-8859-1"?><
|
106
|
+
'<?xml version="1.0" encoding="ISO-8859-1"?><response><msgtype>1230</msgtype><amount>100</amount><time>080107061755</time><pbsstat>000</pbsstat><qpstat>000</qpstat><qpstatmsg>OK</qpstatmsg><currency>DKK</currency><ordernum>4820346075804536193</ordernum><transaction>2865261</transaction><merchant>Shopify</merchant><merchantemail>pixels@jadedpixel.com</merchantemail></response>'
|
107
107
|
end
|
108
108
|
|
109
109
|
def failed_authorization_response
|
110
|
-
'<?xml version="1.0" encoding="ISO-8859-1"?><
|
110
|
+
'<?xml version="1.0" encoding="ISO-8859-1"?><response><qpstat>008</qpstat><qpstatmsg>Missing/error in card verification data</qpstatmsg></response>'
|
111
111
|
end
|
112
112
|
end
|
@@ -58,6 +58,18 @@ class TrustCommerceTest < Test::Unit::TestCase
|
|
58
58
|
assert_equal [:visa, :master, :discover, :american_express, :diners_club, :jcb], TrustCommerceGateway.supported_cardtypes
|
59
59
|
end
|
60
60
|
|
61
|
+
def test_test_flag_should_be_set_when_using_test_login_in_production
|
62
|
+
Base.gateway_mode = :production
|
63
|
+
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
64
|
+
assert response = @gateway.purchase(@amount, @credit_card)
|
65
|
+
assert_success response
|
66
|
+
assert response.test?
|
67
|
+
ensure
|
68
|
+
Base.gateway_mode = :test
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
61
73
|
def successful_purchase_response
|
62
74
|
<<-RESPONSE
|
63
75
|
transid=025-0007423614
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../test_helper'
|
2
|
+
|
3
|
+
class QuickpayHelperTest < Test::Unit::TestCase
|
4
|
+
include ActiveMerchant::Billing::Integrations
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@helper = Quickpay::Helper.new('order-500','24352435', :amount => 500, :currency => 'USD')
|
8
|
+
@helper.md5secret "mysecretmd5string"
|
9
|
+
@helper.return_url 'http://example.com/ok'
|
10
|
+
@helper.cancel_return_url 'http://example.com/cancel'
|
11
|
+
@helper.notify_url 'http://example.com/notify'
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_basic_helper_fields
|
15
|
+
assert_field 'merchant', '24352435'
|
16
|
+
assert_field 'amount', '500'
|
17
|
+
assert_field 'ordernumber', 'order500'
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_generate_md5string
|
21
|
+
assert_equal '3authorize24352435daorder500500USDhttp://example.com/okhttp://example.com/cancelhttp://example.com/notify00mysecretmd5string',
|
22
|
+
@helper.generate_md5string
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_generate_md5check
|
26
|
+
assert_equal '31a0a94ce953208d05f3f3d255fff31f', @helper.generate_md5check
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_unknown_mapping
|
30
|
+
assert_nothing_raised do
|
31
|
+
@helper.company_address :address => '500 Dwemthy Fox Road'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_setting_invalid_address_field
|
36
|
+
fields = @helper.fields.dup
|
37
|
+
@helper.billing_address :street => 'My Street'
|
38
|
+
assert_equal fields, @helper.fields
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../test_helper'
|
2
|
+
|
3
|
+
class QuickpayNotificationTest < Test::Unit::TestCase
|
4
|
+
include ActiveMerchant::Billing::Integrations
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@quickpay = Quickpay::Notification.new(http_raw_data, :md5secret => "mysecretmd5string")
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_accessors
|
11
|
+
assert @quickpay.complete?
|
12
|
+
assert_equal "000", @quickpay.status
|
13
|
+
assert_equal "88", @quickpay.transaction_id
|
14
|
+
assert_equal "order-4232", @quickpay.item_id
|
15
|
+
assert_equal "89.50", @quickpay.gross
|
16
|
+
assert_equal "DKK", @quickpay.currency
|
17
|
+
assert_equal Time.parse("2008-11-05 21:57:37"), @quickpay.received_at
|
18
|
+
assert @quickpay.test?
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_compositions
|
22
|
+
assert_equal Money.new(8950, 'DKK'), @quickpay.amount
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_acknowledgement
|
26
|
+
assert @quickpay.acknowledge
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_failed_acknnowledgement
|
30
|
+
@quickpay = Quickpay::Notification.new(http_raw_data, :md5secret => "badmd5string")
|
31
|
+
assert !@quickpay.acknowledge
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_acknowledgement_with_cardnumber
|
35
|
+
@quickpay = Quickpay::Notification.new(http_raw_data_with_cardnumber, :md5secret => "mysecretmd5string")
|
36
|
+
assert @quickpay.acknowledge
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_quickpay_attributes
|
40
|
+
assert_equal "Authorized", @quickpay.state
|
41
|
+
assert_equal "authorize", @quickpay.msgtype
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_generate_md5string
|
45
|
+
assert_equal "authorizeorder-42328950DKK081105215737Authorized000Ok000OK89898989info@pinds.com88visa-dkYesmysecretmd5string",
|
46
|
+
@quickpay.generate_md5string
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_generate_md5check
|
50
|
+
assert_equal "e70bd0e528dc335ac74d5f1c348fe2f4", @quickpay.generate_md5check
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_respond_to_acknowledge
|
54
|
+
assert @quickpay.respond_to?(:acknowledge)
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
def http_raw_data
|
59
|
+
"msgtype=authorize&ordernumber=order-4232&amount=8950¤cy=DKK&time=081105215737&state=Authorized&" +
|
60
|
+
"chstat=000&chstatmsg=Ok&qpstat=000&qpstatmsg=OK&merchant=89898989&merchantemail=info@pinds.com&transaction=88&" +
|
61
|
+
"cardtype=visa-dk&testmode=Yes&md5check=e70bd0e528dc335ac74d5f1c348fe2f4"
|
62
|
+
end
|
63
|
+
|
64
|
+
def http_raw_data_with_cardnumber
|
65
|
+
"msgtype=authorize&ordernumber=order-4232&amount=8950¤cy=DKK&time=081105215737&state=Authorized&" +
|
66
|
+
"chstat=000&chstatmsg=Ok&qpstat=000&qpstatmsg=OK&merchant=89898989&merchantemail=info@pinds.com&transaction=88&" +
|
67
|
+
"cardtype=visa-dk&testmode=Yes&cardnumber=XXXXXXXXXXXX4092&md5check=bded8685e10790a9351a9d51285cec9d"
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
|
3
|
+
class QuickpayModuleTest < Test::Unit::TestCase
|
4
|
+
include ActiveMerchant::Billing::Integrations
|
5
|
+
|
6
|
+
def test_notification_method
|
7
|
+
assert_instance_of Quickpay::Notification, Quickpay.notification('name=cody')
|
8
|
+
end
|
9
|
+
end
|
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.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Luetke
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
hPaSTyVU0yCSnw==
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date:
|
33
|
+
date: 2009-04-24 00:00:00 -04:00
|
34
34
|
default_executable:
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
requirements:
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
44
|
+
version: 2.3.2
|
45
45
|
version:
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: builder
|
@@ -169,6 +169,10 @@ files:
|
|
169
169
|
- lib/active_merchant/billing/integrations/paypal/notification.rb
|
170
170
|
- lib/active_merchant/billing/integrations/paypal/return.rb
|
171
171
|
- lib/active_merchant/billing/integrations/paypal.rb
|
172
|
+
- lib/active_merchant/billing/integrations/quickpay
|
173
|
+
- lib/active_merchant/billing/integrations/quickpay/helper.rb
|
174
|
+
- lib/active_merchant/billing/integrations/quickpay/notification.rb
|
175
|
+
- lib/active_merchant/billing/integrations/quickpay.rb
|
172
176
|
- lib/active_merchant/billing/integrations/return.rb
|
173
177
|
- lib/active_merchant/billing/integrations/two_checkout
|
174
178
|
- lib/active_merchant/billing/integrations/two_checkout/helper.rb
|
@@ -190,8 +194,6 @@ files:
|
|
190
194
|
- lib/certs/cacert.pem
|
191
195
|
- lib/support
|
192
196
|
- lib/support/gateway_support.rb
|
193
|
-
- lib/tasks
|
194
|
-
- lib/tasks/cia.rb
|
195
197
|
- test/extra
|
196
198
|
- test/extra/binding_of_caller.rb
|
197
199
|
- test/extra/breakpoint.rb
|
@@ -319,6 +321,7 @@ files:
|
|
319
321
|
- test/unit/integrations/helpers/hi_trust_helper_test.rb
|
320
322
|
- test/unit/integrations/helpers/nochex_helper_test.rb
|
321
323
|
- test/unit/integrations/helpers/paypal_helper_test.rb
|
324
|
+
- test/unit/integrations/helpers/quickpay_helper_test.rb
|
322
325
|
- test/unit/integrations/helpers/two_checkout_helper_test.rb
|
323
326
|
- test/unit/integrations/hi_trust_module_test.rb
|
324
327
|
- test/unit/integrations/nochex_module_test.rb
|
@@ -329,8 +332,10 @@ files:
|
|
329
332
|
- test/unit/integrations/notifications/nochex_notification_test.rb
|
330
333
|
- test/unit/integrations/notifications/notification_test.rb
|
331
334
|
- test/unit/integrations/notifications/paypal_notification_test.rb
|
335
|
+
- test/unit/integrations/notifications/quickpay_notification_test.rb
|
332
336
|
- test/unit/integrations/notifications/two_checkout_notification_test.rb
|
333
337
|
- test/unit/integrations/paypal_module_test.rb
|
338
|
+
- test/unit/integrations/quickpay_module_test.rb
|
334
339
|
- test/unit/integrations/returns
|
335
340
|
- test/unit/integrations/returns/chronopay_return_test.rb
|
336
341
|
- test/unit/integrations/returns/gestpay_return_test.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/tasks/cia.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
# Figure out the root path of this app. The default method will assume that
|
2
|
-
# its the same as the location of the running Rakefile
|
3
|
-
ROOT = File.expand_path(FileUtils.pwd) + '/'
|
4
|
-
|
5
|
-
# Standard settings, you can override each of them using the environment
|
6
|
-
# e.g. rake cia EMAIL_TO=your@email.com
|
7
|
-
#
|
8
|
-
RAKE_TASK = ENV['RAKE_TASK'] || ''
|
9
|
-
EMAIL_TO = ENV['EMAIL_TO'] || 'tobi@leetsoft.com'
|
10
|
-
EMAIL_FROM = ENV['EMAIL_FROM'] || 'CIA <cia@jadedpixel.com>'
|
11
|
-
|
12
|
-
# Get last segment of application's path and treat it as name.
|
13
|
-
NAME = ENV['NAME'] || ROOT.scan(/(\w+)\/$/).flatten.first.capitalize
|
14
|
-
|
15
|
-
|
16
|
-
class Build
|
17
|
-
attr_reader :status, :output, :success
|
18
|
-
|
19
|
-
def self.run
|
20
|
-
Build.new.run
|
21
|
-
end
|
22
|
-
|
23
|
-
def run
|
24
|
-
update if @status.nil?
|
25
|
-
make if @success.nil?
|
26
|
-
end
|
27
|
-
|
28
|
-
def revision
|
29
|
-
info['Revision'].to_i
|
30
|
-
end
|
31
|
-
|
32
|
-
def url
|
33
|
-
info['URL']
|
34
|
-
end
|
35
|
-
|
36
|
-
def commit_message
|
37
|
-
`svn log #{ROOT} -rHEAD`
|
38
|
-
end
|
39
|
-
|
40
|
-
def author
|
41
|
-
info['Last Changed Author']
|
42
|
-
end
|
43
|
-
|
44
|
-
def tests_ok?
|
45
|
-
run if @success.nil?
|
46
|
-
@success == true
|
47
|
-
end
|
48
|
-
|
49
|
-
def has_changes?
|
50
|
-
update if @status.nil?
|
51
|
-
@status =~ /[A-Z]\s+[\w\/]+/
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def update
|
57
|
-
@status = `svn update #{ROOT}`
|
58
|
-
end
|
59
|
-
|
60
|
-
def info
|
61
|
-
@info ||= YAML.load(`svn info #{ROOT}`)
|
62
|
-
end
|
63
|
-
|
64
|
-
def make
|
65
|
-
@output, @success = `cd #{ROOT} && rake #{RAKE_TASK}`, ($?.exitstatus == 0)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
task :cia do
|
70
|
-
build = Build.new
|
71
|
-
|
72
|
-
if build.has_changes? and not build.tests_ok?
|
73
|
-
|
74
|
-
require 'actionmailer'
|
75
|
-
|
76
|
-
ActionMailer::Base.delivery_method = :sendmail
|
77
|
-
|
78
|
-
class Notifier < ActionMailer::Base
|
79
|
-
def failure(build, sent_at = Time.now)
|
80
|
-
@subject = "[#{NAME}] Build Failure (##{build.revision})"
|
81
|
-
@recipients, @from, @sent_on = EMAIL_TO, EMAIL_FROM, sent_at
|
82
|
-
@body = ["#{build.author} broke the build!", build.commit_message, build.output].join("\n\n")
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
Notifier.deliver_failure(build)
|
87
|
-
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|